Log in or register to post comments

Unable to delete the model prefab in OnTrackingLost() - Please help

June 16, 2014 - 8:04am #1

I am developing a module in which I am using user defined targets.
Also in the same module i am swapping two models simultaneously.

I am able to use user defined targets and also able to swap the models on run time.

But the problem arises when i use TrackableHandlerScript's onTrackingLost() method. I am getting the logs when this method gets triggered , but unable to remove the 3d model on the screen. When the tracking is lost the model still remains on the screen.

private void OnTrackingLost()
{
Renderer[] rendererComponents = GetComponentsInChildren(true);
Collider[] colliderComponents = GetComponentsInChildren(true);

// Disable rendering:
foreach (Renderer component in rendererComponents)
{
component.enabled = false;
}

// Disable colliders:
foreach (Collider component in colliderComponents)
{
component.enabled = false;
}

Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " lost");
}

I am getting the logs but unable to remove the targets on screen.

Log in or register to post comments