ValveSoftware / steamvr_unity_plugin

SteamVR Unity Plugin - Documentation at: https://valvesoftware.github.io/steamvr_unity_plugin/
BSD 3-Clause "New" or "Revised" License
1.02k stars 254 forks source link

SteamVR haptics failing in Unity 2022.3.+ #1096

Open Giantbean opened 1 year ago

Giantbean commented 1 year ago

I have been trying to get Steam VR to work with open XR for far too long I have Hurricane VR with Steam VR implementation on an XR rig and it was working in an older unity build however I recently updated a project to Unity 2022.3.1 LTS but ever since I have had terrible frame rates and I am getting an error that I have no idea how to fix.

[SteamVR] TriggerHapticVibrationAction (/actions/HVR/out/Haptics) error: NoData handle: 1152950504226030324 UnityEngine.Debug:LogError (object) Valve.VR.SteamVR_Action_Vibration_Source:Execute (single,single,single,single) (at Assets/SteamVR/Input/SteamVR_Action_Vibration.cs:207) Valve.VR.SteamVR_Action_Vibration:Execute (single,single,single,single,Valve.VR.SteamVR_Input_Sources) (at Assets/SteamVR/Input/SteamVR_Action_Vibration.cs:49) HurricaneVR.Framework.SteamVR.HVRSteamVRController:Vibrate (single,single,single) (at Assets/HurricaneVR/Framework/Scripts/SteamVR/HVRSteamVRController.cs:146) HurricaneVR.Framework.Components.HVRHandImpactHaptics:Vibrate (single,single,single) (at Assets/HurricaneVR/Framework/Scripts/Components/HVRHandImpactHaptics.cs:45) HurricaneVR.Framework.Components.HVRImpactHapticsBase:OnCollisionEnter (UnityEngine.Collision) (at Assets/HurricaneVR/Framework/Scripts/Components/HVRImpactHapticsBase.cs:57) UnityEngine.Physics:OnSceneContact (UnityEngine.PhysicsScene,intptr,int)

With a matching error (likely for the other hands haptics) [SteamVR] TriggerHapticVibrationAction (/actions/HVR/out/RightHaptics) error: NoData handle: 1152950504226030325 UnityEngine.Debug:LogError (object)

I have tried updating to the newer 2022 LTS but have had many issues.

Please advise. Thank you.

Giantbean commented 12 months ago

I am using a character rig that has worked prior to the new Unity versions so the action inputs should all be the same. Also the HTTP in some code needs to update to HTTPS in the repo for ease of use. image image

zite commented 12 months ago

Heya, not sure why this isn't working. Can you provide a full unity log?

Giantbean commented 12 months ago

Editor.log Thanks. Hope the log helps.

zite commented 12 months ago

Unfortunately I'm not seeing anything super obvious in the logs. It looks like its failing during initialization, which is pretty odd. I've got a few suggestions but its hard to guess what's wrong with an existing project. If you can give repro steps I could debug further. As to my guesses though: Maybe disable the OpenXR loader? If that tries to initialize first that could break things. Are you running a super old version of SteamVR itself? Also try saving and regenerating actions in the SteamVR Input window.

Giantbean commented 12 months ago

I'm using SteamVR 1.16.8; the current OpenXR runtime is SteamVR. Unity Project Settings are set to OpenXR Play mode runtime SteamVR and I have tried using just OpenVR. Things work in Unity 2020 and 2021 versions so I think this is a Unity 2022 issue. I have made 8 test projects and updated three projects from 2021 to 2022 and all of them have issues. I have uninstalled all Unity versions and Hub and reinstalled just LTS versions and every time I get errors, crashes, and terrible frame rates. Projects that were getting steady 90+ fps drop to 30- as soon as I bring them into 2022 Even Unity's own XR framework example bounces between just 40 and 70 fps.

zite commented 12 months ago

The SteamVR Unity Plugin will not function if you try to use OpenXR. It is made exclusively to work with OpenVR. I'd recommend removing the OpenXR package and then we can take a look at the editor log again.

Giantbean commented 12 months ago

Will do. I have an older project with both in it and it works fine

image

but if I have to choose one or the other I will use SteamVR so long as I can get it working in Unity 2022.

It seems one trick to making it work with both is to not fix the input system

image

At least in older versions of Unity. So the OpenXR is likely redundant and doing nothing but adding the project's file size. :P