Search Unity

Question new input system: inputAction.triggered always returns false

Discussion in 'Input System' started by Tobias3112, Dec 17, 2020.

  1. Tobias3112

    Tobias3112

    Joined:
    May 9, 2017
    Posts:
    16
    I want to use the new action based approach in the XR Interaction Toolkit which uses the new input system. The sample project for the XR Toolkit works fine, but when I use the new input system on my own project the button actions property "triggered" always returns false.

    I use Unity 2019.3 at the moment with the legacy XR system. I set up a new project and imported the XR Toolkit (0.10.0) together with the "Default Input Action".

    The Scene contains the XR Interaction Manager, the Roomscale XR Rig (Action based) as well as a Locomotion System. A basic Input Test script is attached to the controller GameObjects and looks like:
    Code (CSharp):
    1. public class InputTest : MonoBehaviour
    2. {
    3.     public InputActionReference select;
    4.  
    5.     void Update()
    6.     {
    7.         var selectAction = select.action;
    8.      
    9.  
    10.         if (selectAction.triggered)
    11.         {
    12.             Debug.Log("triggered");
    13.         }
    14.     }
    15.  
    16. }
    A proper InputActionReference is set. It is the Select action from the Default Input Action sample. The Select Action Type is a Button and in the player settings I activated the new Input System, but the Debug message never appears in the console and if I print the value of the selectAction.triggered variable it is always false. If I try the readValue<float>() function of the selectAction I get proper values like 0 and 1.

    The Action is also Enabled.

    Does anyone have an idea why the triggered value is always false?
     
    Last edited: Dec 17, 2020
  2. Tobias3112

    Tobias3112

    Joined:
    May 9, 2017
    Posts:
    16

    I solved this as I recognized I need to use at least Unity 2019.4 LTS and I was using 2019.3.