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
- “Remove Unused Overrides” available on not loaded Scene and throws “ArgumentException: The scene is not loaded” warning
- Adaptive Probe Volume occlusion edge is calculated incorrectly when viewing probes near geometry edges
- Sampling a texture using an HLSL file throws shader errors and the code does not compile
- "Graphics.CopyTexture called with null source texture" error when Base Camera of an Overlay Camera is removed with DX11 Graphics API and Compatibility Mode enabled
- WebGL sends wrong value with large numbers when SendMessage function is used
Resolution Note:
We are deprecating old input system bugs as we have moved all resources to the new input system.