Scene Change Problem in Multiplayer VR Game

Evening All

So, here’s a weird one.

Since we’re not planning on releasing anything till much later in the year, we’re using the OpenXR plugin for VR now that that is available. Developing in 2020.3LTS, and using the Pun2 plugin for multiplayer.

Everything runs smoothly in simple scenes (and I cannot overstate, SIMPLE), however, when using the Pun scene changing code to do a scene change for all connected players on more complex scenes, those using HTC Vive via SteamVR 1.16.10, load the scene, and get controller button input, but the compositor sits in the SteamVR space with the Unity3D logo and “Waiting”, with no position tracking on the headset or controllers.

It is a very odd, whereas Oculus Quest and Vive Cosmos, which aren’t using SteamVR, are loading in and interacting just fine.

We’re using the new input system, and the debug for that is showing no tracking.

Any thoughts? As i said, it’s working on simple scenes, and I can load the complex scenes in just fine when I do it manually in a non-network mode.

Regards
Steve

Found a possible solution, it seems that there may be a timeout issue with OpenXR when switch scenes, as this seems to not just be a Multiplayer issue. The fix is to restart the active XR Loader.

Running into a similar situation with OpenXR, when loading a scene, Valve devices will disconnect from Unity and no longer pickup position tracking. Can you expand on how you restart the active XR Loader?

There are a number of threads in the forum discussing how to manually start/stop XR as well as documentation around that here. Restarting the loader is similar to manually starting it.

@joejo
Thanks for the link. I have attempted to implement the first snippet of the coroutine to manually starting it whenever it does not detect the headset, however, the result is the same for Valve Index:

  • If the headset is asleep at the start of unity play
    OR
  • If during a scene load that takes too long, the headset seems to lose connection to the game

THEN

  • The headset will never reconnect and all tracking is lost.
  • The unity game view camera will be stuck at whatever angle the headset was at the point of disconnect
  • Inside the headset, it will say “waiting for [Name of Unity Program]”

This is the code I am currently using to try to “wake up” or reconnect the headset:

void Update() {
    if (XRSettings.isDeviceActive) {
            onscreenText.text = "";
        } else {
                onscreenText.text = "<color=red>HEADSET ASLEEP OR NOT DETECTED</color>";
                StartCoroutine(StartXRCoroutine());
    }

}

public IEnumerator StartXRCoroutine() {
        Debug.Log("Initializing XR...");
        yield return XRGeneralSettings.Instance.Manager.InitializeLoader();

        if (XRGeneralSettings.Instance.Manager.activeLoader == null) {
            Debug.LogError("Initializing XR Failed. Check Editor or Player log for details.");
        } else {
            Debug.Log($"Starting XR...{XRGeneralSettings.Instance.Manager.activeLoader.name}");
            XRGeneralSettings.Instance.Manager.StartSubsystems();
        }
    }

Any ideas on what might be going on here?

EDIT: Something interesting to note, if I switch headsets to Oculus Rift but continue to use SteamVR as the OpenXR runtime, this problem continues. BUT if I change the OpenXR runtime to Oculus App, this does not happen, the headset can go to sleep, and go through loading screens just fine. So is this a OpenXR + SteamVR issue?