How do I check if SteamVR is installed and Vive is connected?
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).
Answer by ismaelnascimento01 · May 31, 2017 at 05:51 PM
Check link: https://docs.unity3d.com/Manual/VRDevices.html
Hi Ismael, can you be more specific please? I have checked the link and I'm still not sure what I can use. As stated I have tried to use the VRDevice class already although I may be using it incorrectly.