I am currently working on an application using OpenXR. I wanted to be able to start the appliation in desktop mode when no VR device is found. I tried to achieve that using UnityEngine.XR.InputDevices.
var inputDevices = new List<UnityEngine.XR.InputDevice>();
UnityEngine.XR.InputDevices.GetDevices(inputDevices);
Debug.Log(inputDevices.Count);
foreach (var device in inputDevices)
{
Debug.Log(string.Format("Device found with name '{0}' and role '{1}'", device.name, device.characteristics.ToString()));
}
Problem is that when I start the application in the Editor whith my HP Reverb G2 connected it starts correctly using the headset but my list of input device is empty. Did I miss something or is there a simpler way to do that ?
The post from @the_real_apoxol is the way to do this. There is no way to know if a device is connected without starting XR in some way and seeing if it succeeds or not.
Is there an easy way to get a list of devices just in the Editor? For some reason HP Reverb G2 works fine but I can’t manage to listen to button pressing because the device list is always empty