unity-game-engineaugmented-realityvirtual-realityquest

VR Scene after AR Scene not loading properly


I am using openXR to create a unity app for Oculus Quest.

I am trying to open a VR scene after the current AR scene. The AR scene is working fine, but then I call

SceneManager.LoadScene("Room", LoadSceneMode.Single);

and the new scene loads (I hear the sound from the new scene), but nothing is displayed.

At the same time, if I take the helmet off and put it back on, the VR scene starts working (maybe the presence sensor triggers some sort of helmet lifecycle, and when the lifecycle resets, it starts work).

Otherwise, if I move from a VR scene to an AR scene, everything works fine. Separately scenes run fine also.

I've tried calling before loading a new scene and call initialization on new scene, but that doesn't help.

XRGeneralSettings.Instance.Manager.DeinitializeLoader()

Solution

  • On an AR scene, before loading a new scene, you must call:

    XRGeneralSettings.Instance.Manager.StopSubsystems();
    XRGeneralSettings.Instance.Manager.DeinitializeLoader();
    SceneManager.LoadScene("Room VR", LoadSceneMode.Single);
    

    And then in the new single VR scene, call Start:

    XRGeneralSettings.Instance.Manager.InitializeLoaderSync();
    XRGeneralSettings.Instance.Manager.StartSubsystems();