Unity not recognising keyboard input

Hi all!
The issue I’m having is Unity is only responding to Inputs sometimes, very randomly. For example when pressing space to jump or any keys to move the player etc.
The code is fine, it just works sometimes when I press play and then I press play again and it doesn’t work. I added Debug.log and it shows the same: the game only recognises the input every now and then.
I’ve tried the keyboard on the Mac and also an external one.
I’m on Mac Big Sur 11.6 and Unity 2020.3.18f1.
Is there any troubleshooting that I should be doing? Any ideas please?
Thanks in advance,

Maybe you should show it anyway (with code tags)? As diagnosing problems without code is pretty useless.

Do you use the old input system (Input class) or the new one?

Have you veryfied that it is no hardware problem?

Hi @exiguous thanks for your reply! how can I verify it’s not a hardware issue?

I have no Mac so I don’t know. But you probably would experience similar issues in other applications/games.

When posting code you should use code tags , not screenshots.

Since you use Rigidbody and apply forces to it, this should be done in FixedUpdate, not Update. Yet Input should be queried in Update. The usual “solution” for this is to set some bool or value via Update und query (and reset) it in FixedUpdate and apply forces accordingly. I suggest to look in the documentation about Unity’s built-in methods and to follow some tutorials about this topic.

And you should use KeyCodes not string equivalent (error prone).

1 Like