Search Issue Tracker
Won't Fix
Votes
5
Found in
5.6.0b10
Issue ID
888440
Regression
No
[OSX] Input.GetAxis(Mouse) first given value is wrong after Cursor.lockState is set to CursorLockMode.Locked
How to reproduce:
1. Open the attached "New Unity Project 4" project and open "Main" scene
2. Enter playmode
3. Move the mouse to the corner of your screen, the movement in X will be output to the console
4. Press Space button to lock the mouse at the center of the game window
5. Move the mouse slightly
Expected result: Input.GetAxis("Mouse X) returned value is small, since mouse is moved only slightly from center
Actual result: Input.GetAxis("Mouse X") returns a big value, as if movement value would be returned from wherever the mouse cursor were, before it was locked to the center of the game window
Reproduced on 5.4.5f1, 5.5.2p2, 5.6.0f1, 2017.1.0a3
Notes:
1. Issue only happens with first returned value, after setting Cursor.lockState to Locked, the rest of the values seem correct
2. Couldn't reproduce this on Windows 10
Comments (3)
-
Slatey
Aug 23, 2021 01:51
Where is this bug now? I just came across the problem in 2021.1.17f on OSX, no issue on Windows 10.
-
oobartez
Sep 21, 2019 10:55
Two and half years later the bug is still here.
-
fredsa
Oct 02, 2017 21:28
Based on testing on OSX:
- When the mouse is locked (by setting `Cursor.lockState = CursorLockMode.Locked`), the mouse position is immediately updated so that the mouse cursor is now in the center of the game view, although it likely won't see this until the cursor is subsequently unlocked (by setting`Cursor.lockState = CursorLockMode.None`), at which point you'll notice that your mouse position has jumped.
- It seems that `Input.GetAxis("Mouse X")` and `Input.GetAxis("Mouse Y")` fail to take this jump into account, so that the first one or two result values of `Input.GetAxis()` are off, based on how far of a virtual jump the mouse made
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Out-of-bounds memory access with multiple CanvasRenderers under a Canvas when using Mesh API
- Inspector tries to access file after it was deleted when the file was locked in Inspector window
- Changing Transform values in Search window Inspector loses focus while dragging and stopping mouse without releasing dragging action
- Saving changes on the dirty VFX Graph during the Play mode throws "The referenced script (Unknown) on this Behaviour is missing!" warnings
- VFX Graph Debug Info overlaps the "Initialize" block debug info by default
Resolution Note:
We are deprecating old input system bugs as we have moved all resources to the new input system.