Hi, I am new to Vuforia and unity and really want to know what is wrong. I want to track the number of targets detected currently and their position, and found this code on the other forum:
{
StateManager sm = TrackManager.Instance.GetStateManager ();
IEnumerable<TrackableBehaviour> activeTrackables = sm.GetActiveTrackableBehaviours ();
Debug.Log ("List of trackables currently active:");
foreach (TrackableBehaviour tb in activeTrackables) {
Debug.Log("Trackable: " + tb.TrackableName + " " );
}
}
but unity gives me the following error:
error CS0103: The name 'TrackManager' does not exist in the current context.
And also I don't know how to get the position of the detected trackables. How can that be done?
Hi,
I don't know this code above, but I can tell you a different way to do this:
You can write a script like this and put it on a GameObject in the scene:
Then you link your ImageTargets to the script and call from each ImageTarget the increase.function in OnTargetFound() and the decrease function in OnTargetLost(). See Image attached.