"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

Vuforia crashes unity when scripts recompiled while running

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 <015079d9a4ea4f97b4381e694d2310c1>:0 at UnityEditor.PropertyHandler.UseReorderabelListControl (UnityEditor.SerializedProperty property) [0x00008] in <015079d9a4ea4f97b4381e694d2310c1>:0 at UnityEditor.PropertyHandler.GetHeight (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) [0x00059] in <015079d9a4ea4f97b4381e694d2310c1>:0 at UnityEditor.EditorGUI.GetPropertyHeightInternal (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) [0x00007] in <015079d9a4ea4f97b4381e694d2310c1>:0 at UnityEditor.EditorGUI.GetPropertyHeight (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) [0x00001] in <015079d9a4ea4f97b4381e694d2310c1>:0 at UnityEditor.Editor.CanBeExpandedViaAFoldoutWithoutUpdate () [0x00036] in <015079d9a4ea4f97b4381e694d2310c1>: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 <5f5866ec908d4054a9597064f39dbbac>:0 at UnityEditor.PropertyEditor.DrawEditors (UnityEditor.Editor[] editors) [0x002e4] in <015079d9a4ea4f97b4381e694d2310c1>:0 at UnityEditor.PropertyEditor.RebuildContentsContainers () [0x00119] in <015079d9a4ea4f97b4381e694d2310c1>:0 at UnityEditor.InspectorWindow.RedrawFromNative () [0x00012] in <015079d9a4ea4f97b4381e694d2310c1>:0 NullReferenceException: Object reference not set to an instance of an object at UnityEditor.PropertyHandler.IsArrayReorderable (UnityEditor.SerializedProperty property) [0x0005b] in <015079d9a4ea4f97b4381e694d2310c1>:0 at UnityEditor.PropertyHandler.UseReorderabelListControl (UnityEditor.SerializedProperty property) [0x00008] in <015079d9a4ea4f97b4381e694d2310c1>:0 at UnityEditor.PropertyHandler.GetHeight (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) [0x00059] in <015079d9a4ea4f97b4381e694d2310c1>:0 at UnityEditor.EditorGUI.GetPropertyHeightInternal (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) [0x00007] in <015079d9a4ea4f97b4381e694d2310c1>:0 at UnityEditor.EditorGUI.GetPropertyHeight (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) [0x00001] in <015079d9a4ea4f97b4381e694d2310c1>:0 at UnityEditor.Editor.CanBeExpandedViaAFoldoutWithoutUpdate () [0x00036] in <015079d9a4ea4f97b4381e694d2310c1>: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 <5f5866ec908d4054a9597064f39dbbac>:0 at UnityEditor.PropertyEditor.DrawEditors (UnityEditor.Editor[] editors) [0x002e4] in <015079d9a4ea4f97b4381e694d2310c1>:0 at UnityEditor.PropertyEditor.RebuildContentsContainers () [0x00119] in <015079d9a4ea4f97b4381e694d2310c1>:0 at UnityEditor.InspectorWindow.RedrawFromNative () [0x00012] in <015079d9a4ea4f97b4381e694d2310c1>: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

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.

+1 on this. Encountering it daily in my development, it's very reproducible. I have to always remember to quit play mode before editing my scripts, else Unity is guaranteed to crash.

Hey there,


I will check up with our dev team regarding the bug that was reported a few months ago and circle back as soon as possible. In the meantime, could you confirm that the same crash happens with the newest version of Vuforia Engine (10.0.12)?

Thank you!

Hey both,

 

This bug was sadly not raised back in May, but thanks to jcady's response it was brought to my attention and I raised to our R&D!

 

Kind regards,

Patrick Scheper

Technical Community Manager