Search Issue Tracker

By Design

Votes

0

Found in [Package]

1.11.2

Issue ID

ISXB-1196

Regression

No

Key state misreported for ~1 second when refocusing on Game view while using Input System

Package: Input System

-

How to reproduce:
1. Open the attached "IN-88227" project
2. Open the "SampleScene" and enter Play mode
3. Click any window outside the Game window in the Editor to put the window out of focus
4. Refocus on the Game window while holding the Alt key and by clicking with the left mouse button simultaneously
5. Observe the Game window

Expected result: Input is detected immediately
Actual result: There’s a delay in the detection of the input

Reproducible in: 1.7.0 (2021.3.46f1, 2022.3.47f1), 1.11.2 (2021.3.46f1, 2022.3.47f1, 6000.0.27f1, 6000.1.0a4)

Reproducible on: Windows 11
Not reproducible on: macOS 14.6.1 (M1 Pro)

Notes:

* Also reproducible in Player
* Alt key needs to be pressed immediately while re-focusing the Game window, otherwise if there is a delay between pressing Alt and the Left Mouse Button the input detection delay is inconsistent and at times unobservable
* Discussions forum thread regarding this issue - [https://discussions.unity.com/t/key-state-is-misreported-for-1s-when-going-from-unitys-editor-ui-to-focusing-the-game-view/1547742|https://discussions.unity.com/t/key-state-is-misreported-for-1s-when-going-from-unitys-editor-ui-to-focusing-the-game-view/1547742|smart-link]

  1. Resolution Note:

    Closing as there is a workaround to give the desired behaviour in the Editor as discussed in the Discsussion's thread:

    https://discussions.unity.com/t/key-state-is-misreported-for-1s-when-going-from-unitys-editor-ui-to-focusing-the-game-view/1547742/5

    "If you apply these:

    Set Player Settings / Resolution and Presentation / Run In Background to: ON
    Set Input System Package / Settings / Background Behavior to: Ignore Focus
    Set Input System Package / Settings / Play Mode Input Behavior to: All Device Input Always Goes To Game View
    This leads to these two working as you expect:

    Keyboard.current.leftAltKey.ReadUnprocessedValue()
    action.action.IsPressed()"

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.