Question by
papousek · Jul 23, 2021 at 02:04 PM ·
pause menu
Unlock mouse when resuming game
I'm creating a game where I have half-working pause menu. I have locked mouse and when i press esc pause menu will open but i have still locked mouse and i don't know how to unlock the mouse again.
using System.Collections.Generic;
using UnityEngine;
public class PausedMenu : MonoBehaviour
{
public static bool GameIsPaused = false;
public GameObject pauseMenuUI;
void Update ()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
if (GameIsPaused)
{
pauseMenuUI.SetActive(false);
Time.timeScale = 1f;
GameIsPaused = false;
}
else
{
pauseMenuUI.SetActive(true);
Time.timeScale = 0f;
GameIsPaused = true;
}
}
}
}
Please help me
Comment
And how, exactly? I see no code here that is referring to a mouse.(...) I have locked mouse
Your answer
Follow this Question
Related Questions
Pause Menu Problems 1 Answer
Need help with pause menu and cursor lock script conflict 1 Answer
Survival Shooter problems 0 Answers