Log in or register to post comments

Error when Switching Unity Scenes with Digital Eyewear

January 9, 2018 - 10:01am #1

I'm getting this error in Unity when I switch from a scene with no AR camera (main camera has vuforia behaviour disabled) to a scene with an AR camera, but only when digital eyewear is the chosen device type in the Vuforia config. 

Exception in callback: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> UnityEngine.MissingReferenceException: The object of type 'Camera' has been destroyed but you are still trying to access it.

Your script should either check if it is null or you should not destroy the object.

  at (wrapper managed-to-native) UnityEngine.Camera:get_nearClipPlane ()

  at Vuforia.DedicatedEyewearCameraConfiguration.CameraParameterChanged () [0x00000] in <filename unknown>:0

  at Vuforia.DedicatedEyewearCameraConfiguration.CheckForSurfaceChanges (UnityEngine.ScreenOrientation& orientation) [0x00000] in <filename unknown>:0

  at Vuforia.VuforiaARController.UpdateStatePrivate (Boolean forceUpdate, Boolean reapplyOldState) [0x00000] in <filename unknown>:0

  at Vuforia.VuforiaARController.UpdateState (Boolean forceUpdate, Boolean reapplyOldState) [0x00000] in <filename unknown>:0

  at Vuforia.DigitalEyewearARController.Update () [0x00000] in <filename unknown>:0

  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)

  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d0] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222

  --- End of inner exception stack trace ---

  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000eb] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232

  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115

  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000b9] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Delegate.cs:443

  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00018] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/MulticastDelegate.cs:71

  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Delegate.cs:415

  at Vuforia.DelegateHelper.InvokeDelegate (System.Delegate action, System.Object[] args) [0x00000] in <filename unknown>:0

0x00000001412F15D6 (Unity) StackWalker::GetCurrentCallstack

0x00000001412F214F (Unity) StackWalker::ShowCallstack

0x00000001411B11C0 (Unity) GetStacktrace

0x00000001406DA453 (Unity) DebugStringToFile

0x00000001406DAC31 (Unity) DebugStringToFile

0x000000014142A6C2 (Unity) DebugLogHandler_CUSTOM_Internal_Log

0x00000000348D22EB (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,string,UnityEngine.Object)

0x00000000348D21D4 (Mono JIT Code) [DebugLogHandler.cs:9] UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])

0x00000000348D1AD5 (Mono JIT Code) [Logger.cs:47] UnityEngine.Logger:Log (UnityEngine.LogType,object)

0x00000000381EECF3 (Mono JIT Code) [DebugBindings.gen.cs:124] UnityEngine.Debug:LogError (object)

0x00000000348B1953 (Mono JIT Code) Vuforia.DelegateHelper:InvokeDelegate (System.Delegate,object[])

0x00000000348B4844 (Mono JIT Code) Vuforia.DelegateHelper:InvokeWithExceptionHandling (System.Action)

0x0000000034942073 (Mono JIT Code) Vuforia.VuforiaBehaviour:Update ()

0x0000000002817672 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)

0x00007FFE1DD964AF (mono) [mini.c:4937] mono_jit_runtime_invoke

0x00007FFE1DCE8A19 (mono) [object.c:2623] mono_runtime_invoke

0x0000000140A2EAEC (Unity) scripting_method_invoke

0x0000000140A2243A (Unity) ScriptingInvocation::Invoke

0x00000001409E4E71 (Unity) MonoBehaviour::CallMethodIfAvailable

0x00000001409EED0F (Unity) MonoBehaviour::CallUpdateMethod

0x0000000140505156 (Unity) BaseBehaviourManager::CommonUpdate<BehaviourManager>

0x00000001405057D8 (Unity) BehaviourManager::Update

0x000000014071FAB3 (Unity) `InitPlayerLoopCallbacks'::`38'::UpdateScriptRunBehaviourUpdateRegistrator::Forward

0x000000014071CD38 (Unity) PlayerLoop

0x00000001411DE245 (Unity) PlayerLoopController::UpdateScene

0x00000001411DF7C8 (Unity) PlayerLoopController::UpdateSceneIfNeeded

0x00000001411E9BDD (Unity) Application::TickTimer

0x000000014140EB0F (Unity) MainMessageLoop

0x00000001414103B5 (Unity) WinMain

0x0000000141E643A8 (Unity) __tmainCRTStartup

0x00007FFE4E661FE4 (KERNEL32) BaseThreadInitThunk

0x00007FFE511EEF91 (ntdll) RtlUserThreadStart

I'm working with ODG r7s - when I perform the same scene switch on the device, I get this error from ADB: 

01-09 11:01:19.757  7099  7113 E Unity   : Exception in callback: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException:

01-09 11:01:19.757  7099  7113 E Unity   :   at Vuforia.DedicatedEyewearCameraConfiguration.UpdateProjection () [0x00000] in <filename unknown>:0

01-09 11:01:19.757  7099  7113 E Unity   :   at Vuforia.DedicatedEyewearCameraConfiguration.ConfigureVideoBackground () [0x00000] in <filename unknown>:0

01-09 11:01:19.757  7099  7113 E Unity   :   at Vuforia.DedicatedEyewearCameraConfiguration.CheckForSurfaceChanges (UnityEngine.ScreenOrientation& orientation) [0x00000] in <filename unknown>:0

01-09 11:01:19.757  7099  7113 E Unity   :   at Vuforia.VuforiaARController.UpdateStatePrivate (Boolean forceUpdate, Boolean reapplyOldState) [0x00000] in <filename unknown>:0

01-09 11:01:19.757  7099  7113 E Unity   :   at Vuforia.VuforiaARController.UpdateState (Boolean forceUpdate, Boolean reapplyOldState) [0x00000] in <filename unknown>:0

01-09 11:01:19.757  7099  7113 E Unity   :   at Vuforia.DigitalEyewearARController.Update () [0x00000] in <filename unknown>:0

01-09 11:01:19.757  7099  7113 E Unity   :   at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,

I think this error is a bug in Vuforia code. I was able to reproduce this in a new project by simply making two scenes, one with an ARcamera, one with a regular camera, setting device type in Vuforia config to digital eyewear, and switching between the two scenes. If anyone knows how to fix this or a temporary workaround, please let me know.  I'm attaching the project that reproduces the bug. 

AttachmentSize
Package icon bugtest.zip64.22 MB

Error when Switching Unity Scenes with Digital Eyewear

December 12, 2018 - 9:22pm #2

I am having the same issue but on Unity 2018.2.14 and Vuforia 7.5.26 



Exception in callback: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> UnityEngine.MissingReferenceException: The object of type 'Transform' has been destroyed but you are still trying to access it.

Your script should either check if it is null or you should not destroy the object.

  at (wrapper managed-to-native) UnityEngine.Transform:get_localRotation_Injected (UnityEngine.Quaternion&)

  at UnityEngine.Transform.get_localRotation () [0x00000] in <filename unknown>:0

  at Vuforia.DeviceTrackingManager.RecenterPose (UnityEngine.Transform cameraTransform, Vector3 modelCorrectionTransform) [0x00000] in <filename unknown>:0

  at Vuforia.RotationalPlayModeDeviceTrackerImpl.RecenterPoseToCurrentAnchorPointPosition () [0x00000] in <filename unknown>:0

  at Vuforia.RotationalPlayModeDeviceTrackerImpl.Start () [0x00000] in <filename unknown>:0

  at Vuforia.DeviceTrackerARController.StartDeviceTracker () [0x00000] in <filename unknown>:0

  at Vuforia.DeviceTrackerARController.OnEnable () [0x00000] in <filename unknown>:0

  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)

  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d0] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222

  --- End of inner exception stack trace ---

  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000eb] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232

  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115

  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000b9] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Delegate.cs:443

  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00018] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/MulticastDelegate.cs:71

  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Delegate.cs:415

  at Vuforia.DelegateHelper.InvokeDelegate (System.Delegate action, System.Object[] args) [0x00000] in <filename unknown>:0

UnityEngine.Debug:LogError(Object)

Vuforia.DelegateHelper:InvokeDelegate(Delegate, Object[])

Vuforia.DelegateHelper:InvokeWithExceptionHandling(Action)

Vuforia.VuforiaBehaviour:OnEnable()

Log in or register to post comments