Search Unity

Bug AR Debug Menu creation from menu not working (NRE)

Discussion in 'AR' started by Thimo_, Oct 16, 2022.

  1. Thimo_

    Thimo_

    Joined:
    Aug 26, 2019
    Posts:
    59
    When I want to add an AR Debug Menu with AR Foundation 5.0.0 Pre 13 or 5.0.2 I get the following error:

    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.Undo.RegisterCreatedObjectUndo (UnityEngine.Object objectToUndo, System.String name) (at <68dc13de18804097a5f386c11cbbb64f>:0)
    UnityEditor.XR.ARFoundation.SceneUtils.CreateARDebugMenu () (at Library/PackageCache/com.unity.xr.arfoundation@5.0.2/Editor/ARFoundation/SceneUtils.cs:81)
    UnityEditor.GenericMenu:CatchMenu(Object, String[], Int32)

    In SceneUtils.cs it can't find the prefab defined on line 21:

    Code (CSharp):
    1. static readonly string k_DebugMenuPrefab = "Packages/com.unity.xr.arfoundation/Prefabs/DebugMenu.prefab";
     
  2. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,062
    Thanks for this report! We will include a fix for this in our next patch.
     
  3. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,062
    In the meantime as a workaround you can drag and drop the prefab from its location at
    Packages/com.unity.xr.arfoundation/Assets/Prefabs/DebugMenu.prefab