script to lock cursor in unity code example Example: unity mouse lock Cursor.lockState = CursorLockMode.Locked;