Cursor.lockState = CursorLockMode.Locked; code example Example: unity mouse lock Cursor.lockState = CursorLockMode.Locked;