How to achieve this Key behavior

Hi, in many games after you pressed, for example, space key (for dash) it will actually remain pressed for some duration. So, if you currently in attack animation and still pressed space for a dash, and you will still perform dash after this attack animation.

So my question is - what is the best approach to create this behavior? I can simply create some bools for keys with timer time on them. Or is it possible to mimic this with some Unity’s core stuff, like Input control settings?

It’s usually not a feature of the input system (the button isn’t “still pressed”), but a system where user inputs are queued up.

If you’ve played or watched Hearthstone (a game made with Unity btw), then you’ve probably noticed how players can perform several quick actions before their animations / results are shown on the board. In Hearthstone’s case, those actions happen instantaneously behind the scenes with the on-screen representations being queued up.

So you would achieve this by setting some tolerance window (we’ll say 1 second). So, even though there are actions that might restrict input (like an attack in your example), you would allow inputs when that input lockout duration was less than your tolerance.


– input queue tolerance of 1 second

– character attacks, a 3 second animation

– inputs are locked for the first 2 seconds

– inputs are allowed during that last 1 second

– the first recognized command (a dash) is queued up somehow

– once the full 3 seconds have ended, the queued dash happens