Log in or register to post comments

3rd run into AR fails

August 17, 2015 - 12:18am #1

My app opens the AR scene from a main menu and the AR works. 

From the AR scene another non AR scene is loaded and has a back button that reopens the AR scene as if from fresh start as per main menu.

This works fine once, so I can go as follows:

menu -> AR -> non AR -> AR

And the AR reopens and works fine, but if I the go to non AR and back again for a second time I get this in the console:

Failed to set hint 'HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS'  because the ObjectTracker has not been initialized.

I do no understand why the AR loads OK from menu and back from non AR scene once but then fails on subsequent runs?  Do I need to do something special with the AR scene when I navigate away from it before then returning?

 

Thanks

3rd run into AR fails

September 3, 2015 - 1:27am #5

OK, just in case anyone else get this at last I found the problem (but not sure why it is a problem) and a fix!

The output is this just prior to the AR not restarting on return from another scene, see the bold sections and what I have implemented to resolve it

 

It would be really useful if the MODS could advise why this is the case?

 

 

markerTrackerStop
objectTrackerStop
Trackable poster lost
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
MyTrackableEventHandler:OnTrackingLost()
MyTrackableEventHandler:OnTrackableStateChanged(Status, Status)
Vuforia.TrackableBehaviour:OnTrackerUpdate(Status)
Vuforia.DataSetTrackableBehaviour:OnTrackerUpdate(Status)
Vuforia.StateManagerImpl:SetTrackableBehavioursForTrackableToNotFound(Trackable)
Vuforia.ObjectTrackerImpl:Stop()
Vuforia.QCARAbstractBehaviour:StopQCAR()
Vuforia.QCARAbstractBehaviour:OnDisable()
 
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)
 
NullReferenceException
  at UnityEngine.Behaviour.set_enabled (Boolean value) [0x00000] in <filename unknown>:0 
  at MyTrackableEventHandler.OnTrackingLost () [0x00000] in <filename unknown>:0 
  at MyTrackableEventHandler.OnTrackableStateChanged (Status previousStatus, Status newStatus) [0x00000] in <filename unknown>:0 
  at Vuforia.TrackableBehaviour.OnTrackerUpdate (Status newStatus) [0x00000] in <filename unknown>:0 
  at Vuforia.DataSetTrackableBehaviour.OnTrackerUpdate (Status newStatus) [0x00000] in <filename unknown>:0 
  at Vuforia.StateManagerImpl.SetTrackableBehavioursForTrackableToNotFound (Trackable trackable) [0x00000] in <filename unknown>:0 
  at Vuforia.ObjectTrackerImpl.Stop () [0x00000] in <filename unknown>:0 
  at Vuforia.QCARAbstractBehaviour.StopQCAR () [0x00000] in <filename unknown>:0 
  at Vuforia.QCARAbstractBehaviour.OnDisable () [0x00000] in <filename unknown>:0 
 
(Filename: currently not available on il2cpp Line: -1)
 
objectTrackerDeactivateDataSet
objectTrackerDestroyDataSet
objectTrackerStop
markerTrackerStop
trackerManagerDeinitTracker
Error: Marker Tracker could not be deinitialized.
Could not deinitialize the tracker.
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:LogError(Object)
Vuforia.TrackerManagerImpl:DeinitTracker()
Vuforia.QCARAbstractBehaviour:OnDestroy()
 
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)
 
trackerManagerDeinitTracker
Error: Object Tracker could not be deinitialized.
Could not deinitialize the tracker.

 

This in my trackableeventhandler on imagetracker object:

void Awake() {

        // seems if I do this then OnTrackableStateChanged will only run OnTrackingLost during this scene and not as a result 
        // of this scene unloading to another one
        // stops the unable to set hintdeinitialise tracker etc and allows AR to continue restarting between scenes
        PlayerPrefs.SetInt("LoadingLevel"0);

}

 public void OnTrackableStateChanged(TrackableBehaviour.Status previousStatusTrackableBehaviour.Status newStatus) {

        if (newStatus == TrackableBehaviour.Status.DETECTED ||
            newStatus == TrackableBehaviour.Status.TRACKED ||
            newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED) {

            OnTrackingFound();
        }
        else {

            // seems if I do this then OnTrackableStateChanged will only run OnTrackingLost during this scene and not as a result 
            // of this scene unloading to another one
            // stops the unable to set hintdeinitialise tracker etc and allows AR to continue restarting between scenes
            if (PlayerPrefs.GetInt("LoadingLevel") == 0){

                OnTrackingLost();
            }
        }
 }

 

And then in my script that triggers loading another scene:

 

private void HandleSingleTap() {
    
        // stops OnTrackingLost running as we move from AR to another scene
        PlayerPrefs.SetInt("LoadingLevel"1);

        PlayerPrefs.SetString("SelectedImage"touchedName);
    
        // force back to landscape
        Screen.orientation = ScreenOrientation.LandscapeLeft;
    
        Application.LoadLevel("Audio");
}

3rd run into AR fails

August 28, 2015 - 8:32am #4

Hi, I still struggling to get this resolved.... :-(

 

Can anyone help me please?

 

Thanks

3rd run into AR fails

August 21, 2015 - 12:11pm #3

*** UPDATE ***

hi, I just recreated the entire project from scratch and it still happens as described below :-((  

 

Hi, thanks, but could you explain that page as it does not help me re what the problem is (no sample code?) 

 

What I don't under stand is this:

The app starts with non AR scene (menu) that then loads a scene that preps things BEFORE loading the AR scene as follows:

public class LoadingManagerScript : MonoBehaviour {
                 
    private bool mChangeLevel = true;

        void Awake() {
            
            Resources.UnloadUnusedAssets();
            System.GC.Collect();
        }
        
        void Start() {
            
            Resources.UnloadUnusedAssets();
            
            System.GC.Collect();
            
            Application.backgroundLoadingPriority = ThreadPriority.Low;
            
            mChangeLevel = true;
        }
        
        void Update() {
            
            if (mChangeLevel) {
                
                LoadUserDefTargetsScene();
                mChangeLevel = false;
            }
        }

        private void LoadUserDefTargetsScene() {
            
            Application.LoadLevelAsync("ARScene");
        }
}

If I go from menu to AR then back to menu I can do this all day and the AR always works

But

I have another non AR scene (Detail), loaded from the AR scene that just uses Application.LoadScene("Detail")) to load the non AR scene.

If I go from AR scene to Detail scene the AR will work on return for upto 3 times then throws that error.

I also tried to use the prep method to go from AR to Detail but again after abouth 3 times it throa the error

So

I fail to see whay going menu -> Ar -> menu does not cause problems but AR -> Detail -> AR does 

:-(

 

 

 

 

3rd run into AR fails

August 19, 2015 - 5:08pm #2

The error seems to indicate that you're trying to start the camera or set the max hint before initializing the tracker.

http://developer.vuforia.com/library/resources/api/unity/class_vuforia_1_1_tracker_manager

 

Log in or register to post comments