using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class UnlockCursor : MonoBehaviour { public bool lockCursor = true; // Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.F1)) { lockCursor = !lockCursor; } Cursor.lockState = lockCursor ? CursorLockMode.Locked : CursorLockMode.None; Cursor.visible = !lockCursor; } }