Cursor.lockState Not working unity 2018.2

In previous versions of Unity the cursor locked to the center of the screen just fine. When I updated Unity it stopped working. The mouse cursor is invisible when in the game window but is not locked to the center of the game window like it should be. If I look around (FPS) the cursor moves out of the window.

This happens both in the editor and when I build the game. I have a second monitor so in the built version the cursor moves out of the game window and onto my second monitor.

Cursor.lockState = CursorLockMode.Locked;

Is this a bug in the newest version of Unity or am I doing something wrong?


Not working here too. Annoying.

Same here. Unity 2019. Empty project with just the simple implimentation of Cursor.lockState and it doesn’t work in the editor or the build.