I just updated to 2020.3.16 LTS.
All keyboard Input functions such as Input.GetKey() now do not work, unless the mouse cursor is over the Game View.
In all previous versions of Unity, Input.GetKey would work if the Unity Editor is in focus,
even if the mouse cursor was not over the game view.
There is nothing in the patch notes for 2020.3.16 that talk about this, so it seems like a regression.
This new behaviour is frustrating to use Play Mode in the editor now, as after clicking the Play Button, you must move the mouse cursor onto the Game View to have keyboard input do anything.
In case anyone runs into this problem, I’ve also attached the repro here.
I’m on macOS, maybe it works fine on Windows.
1. What happened
REGRESSION in 2020.3.16 LTS
Input.GetKey and all other related input functions does not work when mouse is not over the Game View.
2. How can we reproduce it using the example you attached
SampelScene.unity has a cube that simply turns red when Input.GetKey(spacebar) is held, otherwise the cube will turn black.
1. Open SampleScene.unity
2. Click Play Button with mouse
3. Do not move mouse from PlayButton.
4. Click spacebar -> Cube stays black (Input not detected)
5. Move mouse over Game View
6. Click Spacebar -> CUBE TURNS RED (Input detected)
7. Move mouse away from Game View, onto Project or Hierarchy or Inspector or anything.
8. Click Spacebar -> Nothing Happens (Input not detected)
Check previous versions of Unity (tested on 2020.3.14 and all previous versions of Unity 2019, 2018, 2017)
Input will work even when mouse is not over Game View.