[1.0.0] Two keyboard keys pressed or released simultaneously will only update the state of one
While testing my game I found that sometimes when pressing/releasing multiple buttons quickly many times in a row, sometimes one of the keys get stuck in a pressed state until any other key is pressed.
For example when moving with WASD. If I quickly press and release W & A a few time usually happens after 3-4, W or A (not both) never receives the last 'canceled' event. Pressing any button after a key gets stuck invokes the missing 'canceled' event, letting me to believe that it is in the queue, but for some reason never fired.

i'm having the same problem
About how "cancelled" works, it sounds like it is a bit different from what you think.
Usually, if Cancelled is triggered, it means the Action is not a valid input. For example, you can set an Action to be "performed" after holding down A for 5 seconds. But if the player stops after 3 seconds, "cancelled" is triggered instead of "performed". Because the condition for the Action to be performed is not met, and it is cancelled at that point.
I believe "cancelled" and "performed" are mutually exclusive, since the Action can only succeed or fail.
I get that you can have 'performed' invoked when an input is actuated and when its stops being actuated, but according to the docs (Interactions.md) the default behaviour is started -> performed when a input is actuated and cancelled -> waiting when it stops being actuated. Is this no longer the case?
EDIT: Switching everything to 'Press & Release' the problem still persists and the 'performed' invoke for when a key stops being actuated is still queued until another input is received, instead of being invoked immediately.
I get that you can have 'performed' invoked when an input is actuated and when its stops being actuated, but according to the docs (Interactions.md) the default behaviour is started -> performed when a input is actuated and cancelled -> waiting when it stops being actuated. Is this no longer the case?
Unfortunately, not the case anymore.
Except for Press Interactions, the Started -> Performed part still apply. The Canceled is only triggered if the input is "failed".
If you want to use WASD to control movement, the best way is to make a 2D Vector Composite binding.
If you download the package and project from Github, Assets -> Demo -> SimpleDemo is a good example.
@SKroell I still cannot repro this. Do you have a minimal repro project, or the script to pair with this? It would be easier for us to identify the problem with a project.
Sorry for the very late response. Unfortunately I can still really easily replicate this. I've attached 2 projects, one using the old performed/cancelled workflow and one with passtrough (so everything happens in performed).
Repro steps:
- Open Project
- Open and Start sample scene
- Quickly press A & D rapidly (pressing & releasing both at about the same time)
- Stop and check the console log once in a while to see if a button is stuck
Mostly happens at around 20 rapid inputs, but I've had it happen after only 2. The input will come 'unstuck' after pressing any input, even if the input is not defined in the input actions settings.
On the image below no keys are pressed, yet 'D' was never cancelled and is therefor still in an 'actuated' state.

I've just checked and the issue exists in the SimpleDemo on developer branch as well.
EDIT: I recorded a repro video on my phone, It's really potato quality but hopefully it helps explain the issue. https://imgur.com/a/GUBrWRg @JiaUnity
EDIT2: Another user with same issue, but a more in depth explanation: https://forum.unity.com/threads/bug-with-two-keyboard-keys-pressed-or-released-simultaneously.706955/
Also got the same problem here. My co-worker has the problem every time and I only get it every 10th time or so. Exactly the same behavior from @SKroell´s video.
Just tested and issue stil exists in the SimpleDemo with latest 0.9.2-preview package. @JiaUnity @Rene-Damm any update on whether or not you are tracking this issue internally?
The below Auto hotkey script repro's this bug >90% for me. Ensure the binding is to a mouse button so there are no additional keyboard events
Wheelup:: Send w Send d return
Edit: Been playing with action traces. Using the above script usally results in 4 keyboard events correctly but only 1 action callback occuring
I can confirm the problem exist since at least 0.2.10. It happens in composites and between 2 separate input actions. The AutoHotkey script above can help quite a lot because the bug happens only on keyboard and only if 2 keys are held/released at the same input update.
In the case of a composite (say WASD) action: if the keys are pressed at the same input update only one is considered held. If 2 keys are released simultaneously only one of them is updated to "not held" state.
Pressing or releasing any key on the keyboard causes the "missing event" to be fired and the skipped action is updated to the actual physical key state.
In the case of 2 separate actions and holding down keys my impression is that the behavior was a bit different. Instead of only one of the actions triggered, the 2 actions are triggered (i.e considered held) but one of them only briefly.
Hey, I have the same issue. My configuration is a bit different tho and I can add more details to what happen and how to reproduce. I'm making a Rhythm Game, and this issue is happening often when I pressed 2 buttons at the same time and release it very quickly.
I have set all my button this way, for one button, two actions liked :
- One action set at "Pass Through" for action type and "Any" for Control Type, interaction is "Press", and the trigger behavior is "Press Only".
- One action set at "Pass Through" for action type and "Any" for Control Type, interaction is "Press" and the trigger behavior is "Release Only".
Default Press point, tap time, slow tap time, hold etc... are set to zero. The update mode is set to Manual, and i've set it into the dynamic update look, for testing.
This way I have two actions for one button, one focused on Press only, and the other one to Release only, in separated events (I want it that way).
The problem happens when I pressed on the same frame 2 buttons and release the two button at the same time very quickly, likely the frame after. Check the debug log :

You can see on the log that I press down and left on the same frame, so the pressed action is performed, then immediatly after, the release action is started for both keys. I release the both key at the same after, and then, you can see that only the down button has the "performed" state on the release action
I managed to make the action re-appearing by unfocusing the editor window, and focusing it again, and voilà :

The action is performed "a bit late".
For me this is a major issue regarding rhythm game because players often quickly smash buttons on the keyboard and I got this issue every 10 secondes on every song I play. If anyone has a workaround, I'm taking it too :)
Thanks !
Can confirm there's some wonkiness with rapid, simultaneous keyboard input at least on Windows (but potentially also on other platforms). Migrated this to a FogBugz issue (public, internal) and looking into it.
@BenouKat From what you describe, sounds like there may be more going on there than just missed input. In case you haven't already, could you file a ticket with your repro through the Unity bug reporter?
Hello, I have been investigating this issue but am having trouble recreating it. I have been unable to recreate the issue using the attached examples on 2019.2 and 2019.3. I have also written a test to generate fake keyboard input simultaneously and this has not found any issues, Can you confirm if you are still having this issue? What versions of Unity and the package you are using? What OS are you using?
I am new to Unity. But I am trying to make the first steps making an FPS type of player movement. I have followed the various tutorials for the new Input System. Defining a WASD action. And am still seeing this problem. When I hit 2 keys at once, e.g. W and A to strafe forward and sideways at the same time, the Input System is only detecting 1 event. And the 2D Vector is only containing 1 of the 2 components. It's like one of the keys is completely ignored. I am using Unity 2019.4.1f1. And the Input System 1.0.0. Running on a Windows 10 Home, 10.0.18362 Build 18362 running on a x64 architecture CPU.
@wassmerm Hi. Could you please file a bug report with a sample project and instructions on how to reproduce so QA can verify?