Get HTC Vive (VR) and new input system working

I am trying to get my HTC Vive running with Unity 2021.2.11f1. The position tracking of my headset and controllers generally work, but I have trouble getting the controllers inputs (button presses, touchpad). Somehow I got it working twice on separate days, but with no obvious reason it is again no longer working and I’m unable to get it working again.

Installed packages:

  • Input System 1.3.0
  • OpenXR Plugin 1.3.1
  • XR Legacy Input Helpers 2.1.8
  • XR Plugin Management 4.2.1
  • OpenVR XR Plugin 1.1.4

I want to use Unity’s new input system. In Project Settings → Player “Active Input Handling” is set to “Input System Package (New)”.

I have written a controller script that have InputAction properties I fill out in the Unity editor. I have set keyboard keys to these actions as well as XR input. Keyboard keys are always working, XR input not.

For example, the previous day I had set XR Controller > XR Controller (RightHand) > Optional Controls > touchpad ( <XRController>{RightHand}/touchpad ) set and eventually it was working the previous two days (after switching between VR sample scenes and my scene, restarting SteamVR, restarting Unity…).

I also tried using the InputAction from the OpenXR’s sample (OpenXR Plugin/1.3.1/Controller/ControllerSampleActions.inputactions), but no luck here either.

As for the XR Plugin-Management in the project settings, I can choose the plugins Oculus, OpenVR Loader, OpenXR and Unity Mock HMD. The only ones that should be interesting for me is OpenVR Loader and OpenXR. I tried many combinations.

  • Initialize XR on Startup is checked (otherwise VR wouldn’t start at all)
  • If OpenVR Loader is checked, it is used (even if OpenXR is also checked)
  • If only OpenXR is checked, OpenXR is used

In the OpenXR settings I can add interaction profiles. I added HTC Vive Controller Profile there.

I have attached the Tracked Post Driver to my camera and dummy models for the hands.

  • the head’s position and rotation is perfectly tracked with OpenVR Loader and OpenXR
  • the controller’s position and rotation is only tracked with OpenVR Loader

I don’t receive controller inputs in any case, but it was working yesterday and I did not do any changes regarding the XR packages, settings etc. The controllers are correctly connected to the computer, since everything is working in SteamVR Home and the menu button always opens the system menu, even ingame.

It seems like the HTC Vive controllers (at least those I have) are not compatible with OpenXR in Unity. Instead I can use the SteamVR Unity Plugin (which provides OpenVR Loader in the settings) and enable OpenVR Loader in the settings.

As for the input, I shall use SteamVR’s input system which perfectly works. Also the SteamVR’s components for position tracking etc. should be used in my specific case.