Search Issue Tracker
Duplicate
Duplicate in 5.0.X
Votes
0
Found in [Package]
5.0.0-pre.10
Issue ID
ARFB-34
Regression
No
Camera Null Ref after going from Menu to Check Support and back
What Happened
I ran the Menu in AR Simulation. From there I chose the Check Support scene, then clicked Return to go back to the menu. This gave two Null Ref errors due to the camera being destroyed.
To See the Bug
Open the ARF Samples project in the Editor.
Open the Assets/Scenes/ARFoundationMenu/Menu scene.
In Build settings, select desktop platforms.
Enable XR Simulation in Project settings.
In Scene view, use the AR Simulation overlay to select the biggest office simulation environment.
Enter Play mode.
Click in Game view, scroll down until you see the Check Support button.
In Game view, click the Check Support button.
In Game view, click the Return button.
Note the errors below in Console; this is the bug.
Configuration
2021.3.0f1.2 (2021.3/staging 6eacc8284459)
MacOS 12.0.1, MacBook Pro (15-inch, 2019), 2.4 GHz 8-Core Intel Core i9
AR Foundation 5.0.0-pre.10 (f6569c5)
Errors
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.
UnityEngine.XR.Simulation.SimulationSessionSubsystem+SimulationProvider.Stop () (at Library/PackageCache/com.unity.xr.arfoundation@5.0.0-pre.10/Runtime/Simulation/Subsystems/SimulationSessionSubsystem.cs:71)
UnityEngine.SubsystemsImplementation.SubsystemWithProvider`3[TSubsystem,TSubsystemDescriptor,TProvider].OnStop () (at /Users/bokken/buildslave/unity/build/Modules/Subsystems/SubsystemWithProvider.cs:56)
UnityEngine.SubsystemsImplementation.SubsystemWithProvider.Stop () (at /Users/bokken/buildslave/unity/build/Modules/Subsystems/SubsystemWithProvider.cs:22)
UnityEngine.XR.ARFoundation.SubsystemLifecycleManager`3[TSubsystem,TSubsystemDescriptor,TProvider].OnDisable () (at Library/PackageCache/com.unity.xr.arfoundation@5.0.0-pre.10/Runtime/ARFoundation/SubsystemLifecycleManager.cs:90)
UnityEngine.XR.ARFoundation.ARSession.OnDisable () (at Library/PackageCache/com.unity.xr.arfoundation@5.0.0-pre.10/Runtime/ARFoundation/ARSession.cs:454)
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.
UnityEngine.XR.Simulation.SimulationSessionSubsystem+SimulationProvider.Stop () (at Library/PackageCache/com.unity.xr.arfoundation@5.0.0-pre.10/Runtime/Simulation/Subsystems/SimulationSessionSubsystem.cs:71)
UnityEngine.SubsystemsImplementation.SubsystemWithProvider`3[TSubsystem,TSubsystemDescriptor,TProvider].OnStop () (at /Users/bokken/buildslave/unity/build/Modules/Subsystems/SubsystemWithProvider.cs:56)
UnityEngine.SubsystemsImplementation.SubsystemWithProvider.Stop () (at /Users/bokken/buildslave/unity/build/Modules/Subsystems/SubsystemWithProvider.cs:22)
UnityEngine.SubsystemsImplementation.SubsystemWithProvider.Destroy () (at /Users/bokken/buildslave/unity/build/Modules/Subsystems/SubsystemWithProvider.cs:31)
UnityEngine.XR.Management.XRLoaderHelper.DestroySubsystem[T] () (at Library/PackageCache/com.unity.xr.management@4.2.0/Runtime/XRLoaderHelper.cs:85)
UnityEngine.XR.Simulation.SimulationLoader.Deinitialize () (at Library/PackageCache/com.unity.xr.arfoundation@5.0.0-pre.10/Runtime/Simulation/SimulationLoader.cs:56)
UnityEngine.XR.ARFoundation.LoaderUtility.Deinitialize () (at Library/PackageCache/com.unity.xr.arfoundation@5.0.0-pre.10/Runtime/ARFoundation/LoaderUtility.cs:50)
UnityEngine.XR.ARFoundation.Samples.SceneUtility.OnSceneUnloaded (UnityEngine.SceneManagement.Scene current) (at Assets/Scripts/SceneUtility.cs:20)
UnityEngine.SceneManagement.SceneManager.Internal_SceneUnloaded (UnityEngine.SceneManagement.Scene scene) (at /Users/bokken/buildslave/unity/build/Runtime/Export/SceneManager/SceneManager.cs:253)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Editor hangs when painting Details containing 2D Mesh on Terrain
- No audio is played when TimelinePlayable has one output
- Scene and Sprite Editor views break when an edge is deleted in an attempt to split geometry
- Specular lighting visible in a camera with Path Tracing when Preserve specular lighting is disabled in observed material
- Cinemachine package throws CS1061 errors in the Console when installed in a project that has HDRP and URP installed
Resolution Note:
null
Duplicate of another internal issue: ARFB-5: Scene switching in AR Simulation casues error in SimulationSessionSubsystem
Resolution Note (5.0.X):
null
Duplicate of another internal issue: ARFB-5: Scene switching in AR Simulation casues error in SimulationSessionSubsystem