I’m trying to figure out how to detect if a button has been released via the new input system (I’m trying to allow jumps to be cancelled) and I can’t seem to find a clear answer anywhere. Help?
Hey. There’s a couple of ways:
-
I would suggest configuring the action as Value and then listening to its
.canceledcallback, as described here: Responding to Actions | Input System | 1.11.2
For a better explanation of the phases (cancelled being one of them), I also suggest reading this: Enum InputActionPhase | Input System | 1.11.2 -
Alternatively, if you prefer to use the Update loop, you can also use
WasReleasedThisFrame()in it.
Responding to Actions | Input System | 1.11.2
But I prefer to use phases and callbacks, they give you more control.
But now you know they both exist!