// Update is called once per frame void Update() { if (Input.GetKeyUp(KeyCode.P)) { paused = !paused; } if (paused) { Time.timeScale = 0; pauseMenu.SetActive(true); gameHUD.SetActive(false); controller.CursorLock(false); } else if (inventoryOpen) { controller.CursorLock(false); } else { Time.timeScale = 1; pauseMenu.SetActive(false); gameHUD.SetActive(true); controller.CursorLock(true); } }