I have a game that can be run in desktop mode and VR mode. The main menu loads in desktop mode to start with as I have set the first entry in the Virtual Reality SDKs list in Player Settings to “None”.
There is a checkbox on the menu to state whether you want to play the game in VR. When the toggle is on and the player clicks Start I then call VRSettings.LoadDeviceByName(“OpenVR”)
and after yielding a frame VRSettings.enabled = true;
This is fine for when the Vive is working however if the user doesn’t have SteamVR installed or the Vive is not connected to their computer I want the checkbox to be disabled. How can I do this?
I know you can check the various states of VR using VRDevice.isPresent
, VRSettings.isDeviceActive
, and VRDevice.model
however these all come back either false or null before I have loaded the device and set VRSettings.enabled to true (something I can’t do until they tick the checkbox and load the game).