Search Issue Tracker

Fixed in 2022.2.X

Fixed in 2021.3.X, 2022.1.X

Fix In Review for 2020.3.X

Votes

2

Found in

2021.2.0a16

2021.2.7f1

2022.1

2022.2

Issue ID

1405273

Regression

Yes

Input system sometimes does not fire canceled event on left-click action

Native Window Management

-

Reproduction steps:
1. Open the attached "1405273.zip" project
2. Open the "SampleScene" scene
3. Enter Play mode
4. Press the left mouse button in the Game view
5. Release it, then quickly press and release it again (might need to repeat the 4th and 5th steps many times to reproduce)
6. Observe the "Cube" GameObject in the Game view

Expected result: The GameObject always returns to red when the left mouse button is released
Actual result: Occasionally the GameObject fails to return to red when the left mouse button is released

Reproducible with: 2020.3.31f1, 2021.2.0a16, 2021.2.14f1, 2022.1.0b10, 2022.2.0a6
Not reproducible with: 2019.4.36f1, 2020.3.30f1

Notes:
- Could not reproduce in builds
- The 4th and 5th steps were done up to 100 times when testing each version
- Tested on Windows

Update:
This is a Windows Runtime bug and isn't specific to Input System package; it just happens to be readily exposed by new input.

It's very difficult to consistently repro the issue, but I've found a technique that seems to work reasonably well: execute a "staggered" double-click.
That is, perform a "normal" click followed immediately by a fast second click. The bug appears to trigger when the second mouse click occurs very quickly after the mouse up from the first click, but note that spamming mouse clicks doesn't seem to work very well.

Even then, it may still take multiple attempts to repro the bug.

  1. Response avatar

    Resolution Note (fix version 2022.2):

    This bug was root-caused to wonky behavior with the Windows DragDetect() API, were it sometimes "eats" the WM_LBUTTONUP message causing the mouse button state (within the GameView) to get "stuck". This API call was added awhile back to fix overly sensitive drag-drop interactions with some Editor UI controls.

    It's unclear if this API behavior is due to a bug in Windows or some undocumented side effect, but a lesson for any Windows devs who stumble onto this page from your Googling: beware DragDetect(); there be dragons here.

    Fixed in 2022.2.0a12

  2. Response avatar

    Resolution Note (fix version 2022.1):

    Fixed in 2022.1.1f1

  3. Response avatar

    Resolution Note (fix version 2021.3):

    Fixed in 2021.3.3f1

Comments (1)

  1. Dad7569b17817a8c877796c17775f095?d=mm

    chistohvalov_a

    Mar 03, 2022 09:26

    Have a similar issue. Investigation of the problem showed that because of the quick mouse click, sometimes mouse button stay in pressed state. I.e. code Mouse.current.leftButton.isPressed returns 'true'. The InputDebugger also shows that the button is pressed at that moments(leftButton control value is 1). The problem can be reproduced for both left and right buttons.

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.