Let say I'm developing a Hybrid app that will lunch in VR mode if the device is daydream ready , other than that it will lunch normally .
void Start(){
if(magical condition) {
EnableVR ();
}
}
IEnumerator LoadDevice(string newDevice, bool enable)
{
VRSettings.LoadDeviceByName(newDevice);
yield return null;
VRSettings.enabled = enable;
}
void EnableVR()
{
StartCoroutine(LoadDevice("daydream", true));
}
void DisableVR()
{
StartCoroutine(LoadDevice("", false));
}
how can I check if the current device is daydream device or not ?
Originating from derHugo's comment, as the documentation links have changed due to a refactor on Unity's end from a
VRnamespace toXR(as it covers all of AR, VR, and MR):XRSettings.loadedDeviceName.htmlwill tell you the type of device that's currently active.XRDevice.modelwill let you know the specific model.