Search Unity

InputAction.triggered Continuous Holding

Discussion in 'Input System' started by ChrisJohnson, Dec 23, 2019.

  1. ChrisJohnson

    ChrisJohnson

    Joined:
    Feb 20, 2013
    Posts:
    64
    Is it possible to get an InputAction.triggered method act like a ButtonControl.isPressed method. So the InputAction.triggered will return true while the action is held down, and not just when it is pressed down.

    I've tried messing with the Interactions in the ActionMap but there doesn't seem to be a way to get continuous holding of a button to work.
     
  2. ChrisJohnson

    ChrisJohnson

    Joined:
    Feb 20, 2013
    Posts:
    64
    I found another thread that had the answer. It looks like you can use something like this.

    Mathf.Approximately(<Name of Input Action>.ReadValue<float>(), 1)