using System.Collections; using System.Collections.Generic; using UnityEngine; public class HideandLockCursor : MonoBehaviour { [SerializeField] private bool _hideOnStart; // Start is called before the first frame update void Start() { if (_hideOnStart) HideCursor(); } public void HideCursor() { Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; } public void ShowCursor() { Cursor.visible = true; Cursor.lockState = CursorLockMode.None; } }