Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

[Believed to be solved] How to query Unity/OpenVR to find out which VR system is in use?

Discussion in 'AR/VR (XR) Discussion' started by Tset_Tsyung, Apr 23, 2019.

  1. Tset_Tsyung

    Tset_Tsyung

    Joined:
    Jan 12, 2016
    Posts:
    411
    Hey all,

    Basically, I'm wanting to check which VR system is in use on the Desktop used by the player (Rift, Vive, RiftCat/VRidge, etc.) however I'm finding that the API documentation for OpenVR is just a blackhole of dispair.

    Has anyone know of a way with which to poll the OpenVR API for current VR system information?

    For example, Steam knows if the user is using Rift, Vive or Vridge (the symbols on the SteamVR app change), how can I get hold of this information in Unity via code/script?

    As always, many thanks for any and all feedback.


    Mike
     
  2. Tset_Tsyung

    Tset_Tsyung

    Joined:
    Jan 12, 2016
    Posts:
    411
    FOUND IT!

    I ran the following line in a start function to output which device is currently loaded.


    Code (CSharp):
    1. using UnityEngine.XR;
    2.  
    3. public class VRDeviceInfoScript : MonoBehaviour
    4. {
    5.    
    6.     // Start is called before the first frame update
    7.     void Start()
    8.     {
    9.         Debug.Log(XRDevice.model);
    10.     }
    11. }
    I was currently testing it with Riftcat 2.0 and VRidge (mobile phone) and the output string was "VRidge".

    Hopefully, this will be of some use to someone else in the futue XD