ValveSoftware / steamvr_unity_plugin

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

Unity 2020.1 XR Input System not receiving Vive controller inputs #844

Closed NilsBernatzki closed 3 years ago

NilsBernatzki commented 3 years ago

Unity 2020.1.7f1 Input System 1.0.0 XR Interaction Toolkit 0.94 (preview) XR Plugin Management 3.2.16

SteamVR 1.14.16 SteamVR Plugin 2.6.1 HTC Vive

Check 1: SteamVR environment -> Inputs work After setting up a new Unity project and importing the mentioned plugins, I can generate the SteamVR controller actions and start the Interaction Sample scene. Tracking and inputs are doing fine.

Check 2: Unity XR Input System Create a new empty scene and place a XRRig in the hierarchy. Create an empty GameObject and add a script with the following code:

protected List<InputDevice> leftHandDevices = new List<InputDevice>();
protected List<InputDevice> rightHandDevices = new List<InputDevice>();

private void Update()
{
    InputDevices.GetDevicesAtXRNode(XRNode.LeftHand, leftHandDevices);
    InputDevices.GetDevicesAtXRNode(XRNode.RightHand, rightHandDevices);

    bool isPressed;

    Debug.Log(leftHandDevices.Count);

    if(leftHandDevices.Count >= 1)
    {
        if(leftHandDevices[0].TryGetFeatureValue(CommonUsages.triggerButton, out isPressed))
        {
            Debug.Log("Left Trigger Pressed");
        }
    }

    if (rightHandDevices.Count >= 1)
    {
        if (rightHandDevices[0].TryGetFeatureValue(CommonUsages.triggerButton, out isPressed))
        {
            Debug.Log("Right Trigger Pressed");
        }
    }
}

Expected: Console writes "1" because Unity XR System detects one left controller device. Console writes "Left/Right Trigger Pressed" once the trigger button on the correct Vive controller gets pressed completely.

Behaviour: While the first Debug.Log writes "1" in the console as expected, the trigger input is not noticed by the new Unity input system.

What could cause this issue?

NilsBernatzki commented 3 years ago

I also checked the Input Debug and there is no changes of "value" once I press the trigger:

image

I noticed that all the controller buttons and states don't even appear in the XR interaction Debugger. Is that normal?

image

kisak-valve commented 3 years ago

Hello @NilsBernatzki, please see the discussion on https://github.com/ValveSoftware/unity-xr-plugin/issues/16#issuecomment-662708512. Unity XR Input is not supported. There are some other options discussed on that issue report.