Change order of VR SDK's at runtime - bug?

Hi all,

I am programming a system in which I wish for user’s to be able to use Oculus, Vive, or Stereoscopic 3D glasses (on a 3D monitor obviously). I had done this in the past and it had worked (I thought), though now something seems to have changed. I have included in the VR settings the 3 respective SDK’s one needs.

I thought the order of the SDK’s in this list would be irrelevant, but it seems that whichever one is first in the list is the one the system uses and seems to ignore the others. I.e. if I have Unity’s Stereo Display (non head-mounted) sdk first, then run the system on a computer with a Vive, the OpenVR sdk will not run and the Vive does not work. If I swap the order to have Vive above the others, the Vive will work.

Any suggestions etc would be much appreciated.

Thanks!

That is correct. At initialization time Unity will select the first device that works when setting up VR. A couple things you can try:

  1. Make sure you disable VR and then manually set the device you want and re-enable VR. In general you should do this whenever you want to change devices. You can do this like so:
VRSettings.LoadDeviceByName(string.Empty);
  1. Add the None device to the start of the list. That will make sure that VR doesn’t auto start in a specific device at launch.
1 Like

Thanks for the reply joejo. I see what you meant from the documentation. I did try this technique however it still doesn’t seem to be working. I print out all supported devices at the start which returns None, OpenVR, stereo, and Oculus in that order (order in VR devices list).

Then I execute the following:

Debug.Log("Loading: " + VRSettings.supportedDevices[3]);

VRSettings.LoadDeviceByName(VRSettings.supportedDevices[3]);

VRSettings.enabled = true;

Debug.Log("Loaded: " + VRSettings.loadedDeviceName);

The output after this code is:

Loading: Oculus
Loaded:

It doesn’t seem to be loading at all. To be clear I am running VRSettings.LoadDeviceByName(string.Empty) at first, then running the above code.