By vutv
on Sat, 07/19/2014 - 14:38
<p>Hello everyone,</p><p><span style="font-size:12px;">I have a problem when </span><span style="letter-spacing: -0.03em; font-family: arial, sans-serif; background-color: transparent;">Creating Cloud Recognition Apps in Unity.</span></p><p>I can't clear old object when have new search result. Object will be overlap (Please see attached file)</p><p>Here is my code:</p><pre class="brush:csharp;">/*==============================================================================Copyright (c) 2012-2014 Qualcomm Connected Experiences, Inc.All Rights Reserved.==============================================================================*/ using System;using UnityEngine; /// <summary>/// This MonoBehaviour implements the Cloud Reco Event handling for this sample./// It registers itself at the CloudRecoBehaviour and is notified of new search results as well as error messages/// The current state is visualized and new results are enabled using the TargetFinder API./// </summary>public class CloudRecoEventHandler : MonoBehaviour, ICloudRecoEventHandler{ #region PRIVATE_MEMBER_VARIABLES // ImageTracker reference to avoid lookups private ImageTracker mImageTracker; private ContentManager mContentManager;private CloudRecoBehaviour mCloudRecoBehaviour; // the parent gameobject of the referenced ImageTargetTemplate - reused for all target search results // private GameObject mParentOfImageTargetTemplate; #endregion // PRIVATE_MEMBER_VARIABLES #region EXPOSED_PUBLIC_VARIABLES /// <summary> /// can be set in the Unity inspector to reference a ImageTargetBehaviour that is used for augmentations of new cloud reco results. /// </summary> public ImageTargetBehaviour ImageTargetTemplate; #endregion #region ICloudRecoEventHandler_IMPLEMENTATION /// <summary> /// called when TargetFinder has been initialized successfully /// </summary> public void OnInitialized() { // get a reference to the Image Tracker, remember it mImageTracker = TrackerManager.Instance.GetTracker<ImageTracker>(); mContentManager = (ContentManager)FindObjectOfType(typeof(ContentManager)); } /// <summary> /// visualize initialization errors /// </summary> public void OnInitError(TargetFinder.InitState initError) { switch (initError) { case TargetFinder.InitState.INIT_ERROR_NO_NETWORK_CONNECTION: ErrorMsg.New("Network Unavailable", "Please check your internet connection and try again.", RestartApplication); break; case TargetFinder.InitState.INIT_ERROR_SERVICE_NOT_AVAILABLE: ErrorMsg.New("Service Unavailable", "Failed to initialize app because the service is not available."); break; } } /// <summary> /// visualize update errors /// </summary> public void OnUpdateError(TargetFinder.UpdateState updateError) { switch (updateError) { case TargetFinder.UpdateState.UPDATE_ERROR_AUTHORIZATION_FAILED: ErrorMsg.New("Authorization Error","The cloud recognition service access keys are incorrect or have expired."); break; case TargetFinder.UpdateState.UPDATE_ERROR_NO_NETWORK_CONNECTION: ErrorMsg.New("Network Unavailable","Please check your internet connection and try again."); break; case TargetFinder.UpdateState.UPDATE_ERROR_PROJECT_SUSPENDED: ErrorMsg.New("Authorization Error","The cloud recognition service has been suspended."); break; case TargetFinder.UpdateState.UPDATE_ERROR_REQUEST_TIME