I am triggering events via Tracking of an Image Target with the following code:
public class NewTrackingCanvas3 : MonoBehaviour, ITrackableEventHandler
private TrackableBehaviour mTrackableBehaviour;
public AudioSourceTracking audiosourcetracking;
mTrackableBehaviour = GetComponent<TrackableBehaviour>();
public void OnTrackableStateChanged(
if (//newStatus == TrackableBehaviour.Status.DETECTED)// ||
newStatus == TrackableBehaviour.Status.TRACKED) //||
//newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED)
// Play audio when target is found
// Stop audio when target is lost
So the audio shall be played when the status is changed to normal. I have different images with different functions on tracking.
Sometimes after some time showing the image, the status is changed back from unknown to normal, although the image is not shown anymore. So the function is called randomly. I also tried implementing it via the OnTrackingFound() function, with the same result.
I am using Unity 2019.2.12f1 and and Vuforia 8.5.9.
Do you have any idea what the reason could be for this behaviour? How can I stop it to change back from unknown to normal without image.