AR Camera outputs only Black after Unloading other scene.

Hey,
I have trouble with AR Session, XR Session Origin and its Camera when loading new Scenes.

During runtime, I keep a separate scene (call it ARSupport) with these Objects loaded, and I can load additional Scenes fine. The problem is, however, when I unload any other scene than ARSupport, even when it has no relation to it, the camera goes black. I can still see my canvas UI, but the output of the camera is only black. This is present both in XR Simulation and on Android… I am at a loss at what to do.

I am using:

  • Unity Editor 2022.3.13f1
  • ARFoundation 5.1.1

Any help is much appreciated.

Is your project based on AR Foundation samples? We have a script in there that will completely disable AR when a scene is unloaded: arfoundation-samples/Assets/Scripts/Runtime/SceneUtility.cs at main · Unity-Technologies/arfoundation-samples · GitHub

You would want to remove this if this is not your intention.

I got it working for Android now, but I will definitely take a look it this. Maybe it solves my problems with XR.Simulation too.