I have this code inside my Update function that locks the cursor at the center of the screen when I press play because CanLook is true by default. Then when I press escape the cursor shows up. The problem is that when the game is running it doesn’t lock the cursor anymore. It just hides it.
if (Input.GetKeyDown ("escape")) {
CanLook = !CanLook;
}
Screen.lockCursor = CanLook;
When I press escape to lock it again and move the mouse if I unlock it the mouse is not center. Can anyone tell my when Screen.lockCursor isn’t centering or locking the mouse. It does it the first time I press play.
UPDATE:
I found out that if I click before unlocking it sets it to the center. So every time I click it gets centered. I am very confused