When the mouse cursor is locked to the center of the screen, (in this case using a mouse look script to rotate the camera) the camera turns around just fine until a certain point, then the view starts jumping around all over the place.
Setting the Cursor.lockState to CursorLockMode.Locked seems to automatically hide the cursor as well.
With the cursor unlocked, the camera rotates around as it should (howerver stops when the cursor exits the game view). Once the game is built, it works as it should.
Edit: Looks like this was fixed in the latest beta build. Thanks!
Yeah I have been getting a similar effect.
I ended up setting up another script thinking it was my code and so I pulled a script from the documentation:
CursorLockMode wantedMode;
// Apply requested cursor state
void SetCursorState ()
{
Cursor.lockState = wantedMode;
// Hide cursor when locking
Cursor.visible = (CursorLockMode.Locked != wantedMode);
}
void OnGUI ()
{
GUILayout.BeginVertical ();
// Release cursor on escape keypress
if (Input.GetKeyDown (KeyCode.Escape))
Cursor.lockState = wantedMode = CursorLockMode.None;
switch (Cursor.lockState)
{
case CursorLockMode.None:
GUILayout.Label ("Cursor is normal");
if (GUILayout.Button ("Lock cursor"))
wantedMode = CursorLockMode.Locked;
if (GUILayout.Button ("Confine cursor"))
wantedMode = CursorLockMode.Confined;
break;
case CursorLockMode.Confined:
GUILayout.Label ("Cursor is confined");
if (GUILayout.Button ("Lock cursor"))
wantedMode = CursorLockMode.Locked;
if (GUILayout.Button ("Release cursor"))
wantedMode = CursorLockMode.None;
break;
case CursorLockMode.Locked:
GUILayout.Label ("Cursor is locked");
if (GUILayout.Button ("Unlock cursor"))
wantedMode = CursorLockMode.None;
if (GUILayout.Button ("Confine cursor"))
wantedMode = CursorLockMode.Confined;
break;
}
GUILayout.EndVertical ();
SetCursorState ();
}
The code above when āLockedā I can turn normally to the left, but if I turn right I get stuck about half a turn in. Also if I begin to look down I look down about 10% then it jumps the camera to almost looking straight down. When I produce a build though it runs fantastic.
Also I notice it seems to have different catching points at time I am uncertain though if this is based on testing the game at a different resolution though or not.
Thank god Iām not the only one. Feels like Mouse.GetAxis āhangsā sometimes, dumping the old value for 0.1 sec or so. All is well in a build as OP reported. (Sensitivity also seems a lot lower for me, but thatās a silly config thing easy to change)
Still having this issue in the latest build (5.2.2f1+20151018). When the cursor is locked, Input.GetAxis and Input.GetAxisRaw return erratic data, resulting in very jumpy first person control. The issue isnāt present in the standalone linux player though, only the editor.
Just thought Iād bump this with a video example https://a.pomf.cat/ytrlnn.webm
this is with slowly moving the mouse up and down - as you can see, there is a large variation in delta values
Well, a somewhat annoying workaround for now would be to have the cursor set to show in the editor until the bugās fixed. Funnily enough, one of the older revisions completely screwed up the analog axis inputs for controllers, making me spin round like an idiot in one spot. (Thatās been fixed now, or using an Xbox controller did it for me, canāt tell which)
Iām seeing the same issues with mouse axis input in 5.3.4f1 that is described in this thread. This is pretty much a 100% blocker of me being able to use the Linux editor with our companyās project day-to-day, as I was hoping to start doing.
I donāt see a Unity rep in this thread yet-- is this actually a known, acknowledged issue? Are forum threads still the best way to report bugs with the Linux editor, as mentioned in the sticky/release topic? EDIT: Ah, I guess that is what the yellow āBUGā tag next to the topic title indicates. n/m!
Bumping because this is the only bug preventing me from using linux 100% of my workflow.
Specifically, whatās happening is, in the Editor only, the cursor in CursorLockMode.Locked is not actually being locked. If you move around the mouse while locked then unlock the cursor, you can see that it is not centered. When the ālockedā cursor is near the edge of the viewport, thatās where you see the extreme sensitivity problems seen in my previous post.
In Linux Player builds, there is no issue since the cursor is properly being centered every frame.
The āBUGā tag is something you can add yourself to a new thread, sadly enough. In the previous thread when the bug was more general (it didnāt work at all when locked) someone from unity did respond.
I have the same issue. Seems like in the editor, when CursorLockMode.Locked is set, the cursor is not locked to the center but acts as a hidden confined mode. When it touches the edges is where the weird axis input starts happening.