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
-
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
- Shader warnings are thrown after building High Definition 3D template
- "EndLayoutGroup: BeginLayoutGroup must be called first" error is thrown when changing Shader Precision Model from the Build Profiles window
- White artifacts/outlines are visible in the Garden Scene when viewing at meshes from a distance
- Shader warnings "Sprite-Unlit-Default" are thrown after building 2D Platrformer Microgame Template
- [Android] HLSL shader becomes corrupted when running on an Android device
Resolution Note:
We are deprecating old input system bugs as we have moved all resources to the new input system.