Desktop or VR Game Resources. Help

I am currently trying to develop a game that can be played “normally” (flat screen monitor) or through VR.

I have made VR games before and am looking into making one that can be played either way based on if the headset is plugged in or not.

Just looking for documentation as I am struggling to find any on making a game that can be played both ways.

If you want to switch between VR on and off, as it was posted recently in a thread of dug up, you do this:

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

And to shut it off you do this:

 XRGeneralSettings.Instance.Manager.StopSubsystems();
                                XRGeneralSettings.Instance.Manager.DeinitializeLoader();

Before this will work though you have to do:

XR Plug-in Management - > and uncheck where it says ‘Initialize XR on Startup’. (just make sure you remember you did this!)

So I’m not entirely sure yet how, but you would create a method like:

if (usingVRHeadset()) {
    //run the start code here.
}

private bool usingVRHeadset() {
   // STILL FIGURING THIS PART OUT, but it's something
  // in the OpenXR api.
}

As of right now, I think you’re gonna want to know which headset you’re mainly targeting as well. Oculus for me doesn’t work when using the OpenXR plugin selected in XR Plug-in Management.

1 Like

I Haven’t had troubles as of yet with my Oculus Rift S not Working with the OpenXR plugin selected. But I will let you know where I get with this. Thanks a lot! I should get around to trying this tomorrow.

In XR Plug-in Management make sure to select ‘Oculus’ to get it working in editor play mode and when you build the EXE for windows.