Mouse.current.leftButton.isPressed is true When WindowsPlayer Regains Focus

Help, In WindowsPlayer after the application regains focus Mouse.current.leftButton.isPressed is true, and first click is invalid.

InputSystem.ResetDevice can resolve my problem.

Thanks, I ran into the same issue and this helped, but the click that regains the focus still isn’t registered, only the one after that.

same issue,anyone know how to fix it?

I’m experiencing this issue as well - LMB is held down when players re-focus the window. Quite frustrating in a survival horror game when you start dumping precious ammo as soon as you click back in.

Coming back to this issue, it seems that the new Input System Package does not update the mouse status when the application is not in focus. So once you click out of the application, that click is registered, and the mouse status is frozen until AFTER the application is re-focused. So you click once to regain focus, the mouse is still registered as having the left mouse button pressed, and stays that way until you click it a second time. It’s likely this issue affects other input devices as well, though I haven’t checked.

I worked around this by switching to using the “Both” option in the Active Input Handling dropdown in the Player settings, and using the old Input Manager’s Input.mousePosition and Input.GetMouseButton(0) / Input.GetMouseButtonDown(0) instead of Mouse.current.position.ReadValue() and Mouse.current.leftButton.isPressed / Mouse.current.leftButton.wasPressedThisFrame.

unity 2019.4.40 is fixed