Log in or register to post comments

ImageTarget and scenemanager.loadscene

August 9, 2016 - 1:21am #1

Hi,

Im using ImageTarget on Vuforia.

I have 2 ImageTarget(have different tags) and 2 different scene.

It is not a problem in a single target to load scenes.

But i want to load 2 or more;

ImageTarget1 >load scene1

ImageTarget2 >load scene2     camera does not turn on and getting error  "failed to initialize vuforia".

Unity dont give me the error about this.

How can i fix this ?

 

private void OnTrackingFound()
        {
            Renderer[] rendererComponents = GetComponentsInChildren<Renderer>(true);
            Collider[] colliderComponents = GetComponentsInChildren<Collider>(true);

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

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

            Debug.Log("Trackable" + mTrackableBehaviour.TrackableName + "found");

   if (mTrackableBehaviour.gameObject.tag == "imagetarget1")
            {
                SceneManager.LoadScene(1);
            }

            if (mTrackableBehaviour.gameObject.tag == "imagetarget2")
            {
                SceneManager.LoadScene(2);

           }

        }

ImageTarget and scenemanager.loadscene

April 23, 2018 - 3:10am #4

I'm trying to change

DefaultTrackableEventHandler.cs

using UnityEngine.SceneManagement;

using UnityEngine;

using Vuforia;

 

but i don't know where to put this code properly

(I put it in protected virtual void OnTrackingFound() but it doesn't work for me)

switch( mTrackableBehaviour.TrackableName )

   {

   case "Trackable1" :

    SceneManager.LoadScene(1, LoadSceneMode.Single);

    break;

   case "Trackable2" :

    SceneManager.LoadScene(0, LoadSceneMode.Single);

    break;

   }

 

 

ImageTarget and scenemanager.loadscene

April 22, 2018 - 6:10am #3

Could I ask how you fixed your script?

I'm trying to load 2 scenes with 2 trackables, but only first working.

 

ImageTarget and scenemanager.loadscene

August 9, 2016 - 2:56am #2

I fixed it.

Log in or register to post comments