Stock Unity VR: Oculus detection

Still trying to support both Vive and Rift with plain Unity. Now, the Oculus Touch buttons map differently to the Joystick names (as shown here: Unity - Manual: XR architecture). Some button IDs (e.g. 0) map to different buttons, e.g. Menu on the Vive and One (“A”) on the Rift. This means I have to KNOW if a Rift or a Vive is installed so I can map the keys to the correct in-game actions.

However, I can’t seem to figure out how to get that info when running OpenVR. If I run with the Oculus runtime only (no OpenVR), I get “Oculus” as a result from VRSettings.loadedDeviceName, and “Touch” from “UnityEngine.Input.GetJoystickNames()”. However, that is not the case when running SteamVR, which also supports the Rift. I always get “OpenVR” back, no matter if the Rift or the Vive is installed.

What is the suggested way of getting this information?

1 Like

This is a common problem and one which Im looking for an official answer from Unity. For the time being I use:

if (VRDevice.model.ToLower().Contains("oculus")) {
1 Like

I must have missed that particular string. Thanks!