Search Unity

Bug Input.GetKey regression in 2020.3.16

Discussion in 'Input System' started by sameng, Aug 14, 2021.

  1. sameng

    sameng

    Joined:
    Oct 1, 2014
    Posts:
    184
    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.

    Or is there a new setting that I am missing?
     
  2. sameng

    sameng

    Joined:
    Oct 1, 2014
    Posts:
    184
    I've submitted a bug report, case 1358134.

    In case anyone runs into this problem, I've also attached the repro here.
    I'm on macOS, maybe it works fine on Windows.

    Code (CSharp):
    1. 1. What happened
    2.  
    3. REGRESSION in 2020.3.16 LTS
    4. Input.GetKey and all other related input functions does not work when mouse is not over the Game View.
    5.  
    6. 2. How can we reproduce it using the example you attached
    7.  
    8. SampelScene.unity has a cube that simply turns red when Input.GetKey(spacebar) is held, otherwise the cube will turn black.
    9.  
    10. 1. Open SampleScene.unity
    11. 2. Click Play Button with mouse
    12. 3. Do not move mouse from PlayButton.
    13. 4. Click spacebar -> Cube stays black (Input not detected)
    14. 5. Move mouse over Game View
    15. 6. Click Spacebar -> CUBE TURNS RED (Input detected)
    16. 7. Move mouse away from Game View,  onto Project or Hierarchy or Inspector or anything.
    17. 8. Click Spacebar -> Nothing Happens (Input not detected)
    18. Check previous versions of Unity (tested on 2020.3.14 and all previous versions of Unity 2019, 2018, 2017)
    19. Input will work even when mouse is not over Game View.
    20.  
     

    Attached Files:

  3. RHPOSITIVE

    RHPOSITIVE

    Joined:
    Nov 11, 2015
    Posts:
    7
  4. sameng

    sameng

    Joined:
    Oct 1, 2014
    Posts:
    184
    Still present in new LTS version 2020.3.17f1.

    Last good LTS version is 2020.3.15


    I believe this bug may be specific to macOS editor.
     
    Last edited: Aug 28, 2021