Log in or register to post comments

Vuforia crashes unity when scripts recompiled while running

May 17, 2021 - 11:36am #1

Vuforia SDK Version: 9.8.8 -

Description with steps to reproduce: Windows 10, 64-bit
MSVC 2019 16.9.5
Vuforia 9.8.8
Unity 2020.3.8f1 LTS

Steps:
---

1. In a scene with Vuforia in it (see note below), press play in the Unity editor.
2. While the editor is in play mode, edit a C# "script" in VS.
3. Switch focus back to the Unity editor. It will recompile the scripts.
4. Stop playback.
5. Start playback again.

Expected Behavior:
---

No issues.

Actual Behavior:
---

Note: Not sure what setup causes this, but in my scene there is a single ReferenceImageTarget and Vuforia is set up to use WEBCAM play mode.

As soon as the scripts are recompiled (step 3), the following error appears in the console:

NullReferenceException: Object reference not set to an instance of an object
Vuforia.VideoBackgroundBehaviour.OnDestroy () (at :0)

On stopping playback (step 4), nothing of interest happens. However, when restarting playback (step 5), one of two things happens (not sure what determines the difference):

About 50% of the time the game screen is replaced with a "Vuforia Initialization Error" ("INIT ERROR: Failed to initialize Vuforia Engine"). When that happens, sometimes you can try again, sometimes not, but the editor becomes generally unstable. About 50% of the time, though, Unity just crashes right away (contact me for logs, not available right now).

Log for Vuforia Initialization Error:

AR:ERROR: 2021-05-17 14:22:14: Vuforia is already initialized. You need to deinitialize before initializing again.
Vuforia initialization failed
UnityEngine.Debug:LogError (object)
Vuforia.VuforiaRuntime:CheckInitStatus (Vuforia.VuforiaUnity/InitError)
Vuforia.VuforiaRuntime:InitInternal ()
Vuforia.VuforiaRuntime:InitVuforia ()
Vuforia.VuforiaRuntime:VuforiaInitialization ()

Vuforia Engine initialization failed: INIT_ERROR
INIT ERROR
Failed to initialize Vuforia Engine.
UnityEngine.Debug:LogError (object)
DefaultInitializationErrorHandlerInternal:SetErrorCode (Vuforia.VuforiaUnity/InitError)
DefaultInitializationErrorHandlerInternal:OnVuforiaInitializationError (Vuforia.VuforiaUnity/InitError)
System.Reflection.MonoMethod:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
System.Reflection.MethodBase:Invoke (object,object[])
System.Delegate:DynamicInvokeImpl (object[])
System.MulticastDelegate:DynamicInvokeImpl (object[])
System.Delegate:DynamicInvoke (object[])
Vuforia.DelegateHelper:InvokeDelegate (System.Delegate,object[])
Vuforia.DelegateHelper:InvokeWithExceptionHandling (System.Action`1,Vuforia.VuforiaUnity/InitError)
Vuforia.VuforiaRuntime:CheckInitStatus (Vuforia.VuforiaUnity/InitError)
Vuforia.VuforiaRuntime:InitInternal ()
Vuforia.VuforiaRuntime:InitVuforia ()
Vuforia.VuforiaRuntime:VuforiaInitialization ()

NullReferenceException: Object reference not set to an instance of an object
at UnityEditor.PropertyHandler.IsArrayReorderable (UnityEditor.SerializedProperty property) [0x0005b] in :0
at UnityEditor.PropertyHandler.UseReorderabelListControl (UnityEditor.SerializedProperty property) [0x00008] in :0
at UnityEditor.PropertyHandler.GetHeight (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) [0x00059] in :0
at UnityEditor.EditorGUI.GetPropertyHeightInternal (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) [0x00007] in :0
at UnityEditor.EditorGUI.GetPropertyHeight (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) [0x00001] in :0
at UnityEditor.Editor.CanBeExpandedViaAFoldoutWithoutUpdate () [0x00036] in :0
at UnityEditor.UIElements.EditorElement.UpdateInspectorVisibility () [0x00007] in :0
at UnityEditor.UIElements.EditorElement.Init () [0x000d2] in :0
at UnityEditor.UIElements.EditorElement..ctor (System.Int32 editorIndex, UnityEditor.IPropertyView iw, System.Boolean isCulled) [0x00034] in :0
at UnityEditor.EditorUIServiceImpl.CreateEditorElement (System.Int32 editorIndex, UnityEditor.IPropertyView iw, System.String title) [0x00000] in :0
at UnityEditor.PropertyEditor.DrawEditors (UnityEditor.Editor[] editors) [0x002e4] in :0
at UnityEditor.PropertyEditor.RebuildContentsContainers () [0x00119] in :0
at UnityEditor.InspectorWindow.RedrawFromNative () [0x00012] in :0

NullReferenceException: Object reference not set to an instance of an object
at UnityEditor.PropertyHandler.IsArrayReorderable (UnityEditor.SerializedProperty property) [0x0005b] in :0
at UnityEditor.PropertyHandler.UseReorderabelListControl (UnityEditor.SerializedProperty property) [0x00008] in :0
at UnityEditor.PropertyHandler.GetHeight (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) [0x00059] in :0
at UnityEditor.EditorGUI.GetPropertyHeightInternal (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) [0x00007] in :0
at UnityEditor.EditorGUI.GetPropertyHeight (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) [0x00001] in :0
at UnityEditor.Editor.CanBeExpandedViaAFoldoutWithoutUpdate () [0x00036] in :0
at UnityEditor.UIElements.EditorElement.UpdateInspectorVisibility () [0x00007] in :0
at UnityEditor.UIElements.EditorElement.Init () [0x000d2] in :0
at UnityEditor.UIElements.EditorElement..ctor (System.Int32 editorIndex, UnityEditor.IPropertyView iw, System.Boolean isCulled) [0x00034] in :0
at UnityEditor.EditorUIServiceImpl.CreateEditorElement (System.Int32 editorIndex, UnityEditor.IPropertyView iw, System.String title) [0x00000] in :0
at UnityEditor.PropertyEditor.DrawEditors (UnityEditor.Editor[] editors) [0x002e4] in :0
at UnityEditor.PropertyEditor.RebuildContentsContainers () [0x00119] in :0
at UnityEditor.InspectorWindow.RedrawFromNative () [0x00012] in :0

Vuforia Engine cannot be started before it is initialized.
Please disable Delayed Initializationin the Vuforia configuration or initialize Vuforia manually with the VuforiaRuntime-class.
UnityEngine.Debug:LogError (object)
Vuforia.VuforiaARController:Start ()
System.Reflection.MonoMethod:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
System.Reflection.MethodBase:Invoke (object,object[])
System.Delegate:DynamicInvokeImpl (object[])
System.MulticastDelegate:DynamicInvokeImpl (object[])
System.Delegate:DynamicInvoke (object[])
Vuforia.DelegateHelper:InvokeDelegate (System.Delegate,object[])
Vuforia.DelegateHelper:InvokeWithExceptionHandling (System.Action)
Vuforia.VuforiaBehaviour:Start () -

Development OS (Mac OS X, Windows, Linux): Windows 10 -

Mobile OS and Version: not applicable -

Mobile Device Manufacturer and Model name: not applicable -

Do the Vuforia Sample Applications show the same behavior?: Unknown

Vuforia crashes unity when scripts recompiled while running

May 18, 2021 - 2:33am #2

Hi,

I was able to reproduce the issues with 2020.3.7 and 9.8.8. Both init error and unity crash. When the init error occurred, hitting play again solved the issue.

This seems also be an edge case with a workaround to stop playmode before editing the script.

I will raise this as an bug with the devs.

Thank you.

Vuforia Engine Support

Log in or register to post comments