Closed wirelessdreamer closed 4 years ago
Do you have any SDK(Oculus SDK or others) imported? Or are you using UnityEngine? If yes, please list the version, thanks!
@wirelessdreamer I just tried over my side with Clean project(Unity 2019.2.0a9) with Oculus SDK(0.0.0) imported. I can query the deviceModel with the API you used. I might need more information to duplicate the issue.
@wirelessdreamer If you can duplicate on your project, could you help to debug in below function,
Print debug message in this function, check which s_defaultState does it return.
This is what I see for Device State: HTC.UnityPlugin.VRModuleManagement.VRModule+DeviceState
Here is a clean project that reproduces the behavior:
https://mega.nz/#!hstAiCIb!3LAqYTRij95zd-2jqaY4Mids5-oRG1JyUitNOn0ZRN8
BodyRole.cs and BindingInterfaceRolePanelController.cs have both been modified. On project start BindingInterfaceRolePanelController will output the device state and model it sees.
I see the same behavior with both a Vive Pro, and Rift CV1
@wirelessdreamer Do you get Unknown device model non-stop or just ~30 times after you start playing? At the very beginning when Unity starts playing, the index 0 will be an invalid index. That's why you will get Unknown for device model. You can try below code to avoid getting invalid index.
if (VRModule.IsValidDeviceIndex(VRModule.HMD_DEVICE_INDEX)) { switch (VRModule.GetDeviceState(VRModule.HMD_DEVICE_INDEX).deviceModel) { case VRModuleDeviceModel.OculusHMD: //... Debug.Log("Device Model: " + VRModule.GetDeviceState(0).deviceModel.ToString()); break; } }
A valid device was never returned in the example above. I hadn't enabled XR support in the uploaded one, but once you enable it in that project the headset works fine, but always says unknown
I enabled the XR Settings, The code you added will only trigger when you click on the BodyRole, HandRole and TrackerRole. You launch the RoleBindingExample scene, am I correct?
In the current release this works on Rift S, but not in Quest build. Quest builds it returns Unknown still
@wirelessdreamer Please share your AndroidManifest.xml and also the version for Unity/Oculus SDK/Oculus XR Plugin, thanks!
https://mega.nz/file/hstAiCIb#3LAqYTRij95zd-2jqaY4Mids5-oRG1JyUitNOn0ZRN8
Can I still reproduce your issue using the link above?
Unity 2019.4.8.f1 Legacy Oculus XR Plugin Oculus plugin 19.1
I reread your previous post about IsValidDeviceIndex, and using this design pattern, I saw the problem was I assumed it would be available before it was. This is always successfull:
IEnumerator WaitForDeviceIndex() {
yield return new WaitUntil(() => VRModule.IsValidDeviceIndex(VRModule.HMD_DEVICE_INDEX));
yield return new WaitForEndOfFrame();
Debug.Log("Headset is: " + VRModule.GetDeviceState(0).deviceModel);
}
Feel free to close this out, though I'd be glad to test or get your more info if its needed.
VRModule.GetDeviceState(0).deviceModel is returning Unknown with an Oculus Rift headset
Expected result is returning: VRModuleDeviceModel.OculusHMD