[IN-35912] AR Simulation error on ArSession.Reset - SimulationProvider.CreateVoxelGrids

In Unity Editor 2022.2.10 with AR Foundation 5.0.5 using XR Simulation, when calling ARSession.Reset, I get the following error:

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.XR.Simulation.SimulationPlaneSubsystem+SimulationProvider.CreateVoxelGrids () (at ./Library/PackageCache/com.unity.xr.arfoundation@5.0.5/Runtime/Simulation/Subsystems/Plane/SimulationPlaneSubsystem.cs:366)

Full error:

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.XR.Simulation.SimulationPlaneSubsystem+SimulationProvider.CreateVoxelGrids () (at ./Library/PackageCache/com.unity.xr.arfoundation@5.0.5/Runtime/Simulation/Subsystems/Plane/SimulationPlaneSubsystem.cs:366)
UnityEngine.XR.Simulation.SimulationPlaneSubsystem+SimulationProvider.OnSimulationSessionReset () (at ./Library/PackageCache/com.unity.xr.arfoundation@5.0.5/Runtime/Simulation/Subsystems/Plane/SimulationPlaneSubsystem.cs:162)
UnityEngine.XR.Simulation.SimulationSessionSubsystem+SimulationProvider.Reset () (at ./Library/PackageCache/com.unity.xr.arfoundation@5.0.5/Runtime/Simulation/Subsystems/SimulationSessionSubsystem.cs:123)
UnityEngine.XR.ARSubsystems.XRSessionSubsystem.Reset () (at ./Library/PackageCache/com.unity.xr.arfoundation@5.0.5/Runtime/ARSubsystems/SessionSubsystem/XRSessionSubsystem.cs:66)
UnityEngine.XR.ARFoundation.ARSession.Reset () (at ./Library/PackageCache/com.unity.xr.arfoundation@5.0.5/Runtime/ARFoundation/ARSession.cs:160)
Controller.StartAR (System.String message) (at Assets/Scripts/Controller.cs:140)
Controller.ToggleAR (System.Boolean ARMode) (at Assets/Scripts/Controller.cs:119)
UnityEngine.Events.InvokableCall`1[T1].Invoke (T1 args0) (at /Users/bokken/build/output/unity/unity/Runtime/Export/UnityEvent/UnityEvent.cs:219)
UnityEngine.Events.UnityEvent`1[T0].Invoke (T0 arg0) (at /Users/bokken/build/output/unity/unity/artifacts/generated/UnityEvent/UnityEvent_1.cs:57)
UnityEngine.UI.Toggle.Set (System.Boolean value, System.Boolean sendCallback) (at ./Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Toggle.cs:284)
UnityEngine.UI.Toggle.set_isOn (System.Boolean value) (at ./Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Toggle.cs:247)
UnityEngine.UI.Toggle.InternalToggle () (at ./Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Toggle.cs:317)
UnityEngine.UI.Toggle.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at ./Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Toggle.cs:328)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at ./Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:57)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at ./Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:272)
UnityEngine.EventSystems.EventSystem:Update() (at ./Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:530)

Reported at:
IN-35912 - [XR Sim] AR Simulation error on ArSession.Reset - SimulationProvider.CreateVoxelGrids

Thanks for the detailed bug report @ROBYER1_1 . We'll take a look at this for our next patch release (a few weeks out). 5.0.5 was otherwise a pretty small release and you should be able to work from 5.0.4 in the meantime. Apologies for the inconvenience.

1 Like