Log in or register to post comments

Prevent Unity to find Markers in Play Mode

May 7, 2019 - 7:06am #1

I need to prevent Unity to find Vuforia Markers when in play mode WITHOUT a webcam.



I have some markers that loads different scenes when tracked; it works well on mobile builds and also in editor>play (with an USB camera plugged in), but without the camera, Vuforia found the markers, even if they are not in sight, and jump to another scene, then found another marker and...continues jumping from one scene to another.

Here is the code:

 

void Start()

    {

        mTrackableBehaviour = GetComponent<TrackableBehaviour>();

        if (mTrackableBehaviour)

        {

            mTrackableBehaviour.RegisterTrackableEventHandler(this);

        }

    }



    public void OnTrackableStateChanged(TrackableBehaviour.Status previousStatus, TrackableBehaviour.Status newStatus)

    {

        if (newStatus == TrackableBehaviour.Status.TRACKED) LoadSpecificScene(SceneToLoad);

    }

 

Any suggestion? Thanks

Prevent Unity to find Markers in Play Mode

May 8, 2019 - 1:23am #3

Yes, if i run the project with unplugged USB camera, Vuforia finds the targets on the first frame, even they are not visible from the camera!

This is the console output:

[...]

Unable to initialize ObjectTracker. Your hardware may not support it.

Start Vufora Engine

Trackable XXX found

Trackable YYY found

Unable to initialize Device Tracker

[...]

I remember that, in my experience, Vuforia always found trackables on the first frame when run from the editor... it was not a problem since now, because in this special casi i load a different scene when a marker is found.



I managed to resolve simply adding a delay condition; not so elegant but it works:

if (Time.timeSinceLevelLoad > 1 && newStatus == TrackableBehaviour.Status.TRACKED) LoadSpecificScene(SceneToLoad);

Thanks

Prevent Unity to find Markers in Play Mode

May 7, 2019 - 12:09pm #2

Hello,

So, if you run your Unity project in Play Mode with *no* camera feed, Vuforia Engine APIs return state changes in the trackables?

This is very counter-intuitive as I cannot understand how Vuforia can detect something it cannot see. If you can provide more details it would be appreciated.

Thanks,

Vuforia Engine Support

Log in or register to post comments