ValveSoftware / unity-xr-plugin

OpenVR plugin for Unity's XR API
BSD 3-Clause "New" or "Revised" License
307 stars 64 forks source link

SteamVR instance is never initialized due to XRSettings.enabled being false #24

Closed methusalah closed 3 years ago

methusalah commented 3 years ago

Running Unity 2020.1.0, HDRP on Windows 10, with SteamVR Unity plugin 2.6.0 and the OpenVR XR plugin v1 preview 12

Running the Interactions_Examples scene, I can see that the player's steam VR objects are disabled and the fallback objects are enabled. I observe the same in my game using a single SteamVR_Behavior_Pose. SteamVR instance is not initialized and a null exception is raised each frame. "Initialize XR on Startup" and "OpenVR loader" are both checked in Unity project settings, and SteamVR 1.13.10 in running on my computer (I also tested with SteamVR shut down).

I've debbuged it a little and it appears that SteamVR instance is never initialized because XRSettings.enabled is false. The only code path where XRSetting.enabled is set to true is by using the boolean "forceUnityVRToOpenVR" with true value, which is only used in the component SteamVR_ForceSteamVRMode, as far as I understand. Of course, XRSettings.enabled could also be set to true in the Unity side but it is not in my situation.

Is there something I'm doing wrong here?

zite commented 3 years ago

That's strange, it should get enabled by the xr system. It looks like XRSettings.enabled is supposed to be deprecated. Can you try going into the XR Management window and just unchecking and rechecking the OpenVR Loader item?

methusalah commented 3 years ago

I've tried that already

methusalah commented 3 years ago

Sorry I've just created a new issue on the SteamVR Unity plugin repository, and I was about to close here. Didn't meant to spam.

zite commented 3 years ago

No problem, sorry that didn't work, let's continue there.