Search Unity

How to continuously know how much time a button is being held?

Discussion in 'Input System' started by FeastSC2, May 28, 2019.

  1. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    978
    1) How can I have an action that's constantly being called while the user is holding the button? (as opposed to called only after the button is being held for a set amount of time).

    2) Is there a way to know the state of the button with the context given by InputAction.CallbackContext (like State.IsHeld, State.IsReleased, State.IsPressed)?