I made a 1st person camera and a pause menu but when testing when I pause my mouse is gone because its 1st person game therefore I cant click and when I put
in the camera script, it just spams the GameIsPaused = true in the console and when I try to open the pause menu it freezes my game like its supposed to but the UI doesn’t show up but when I remove it and test it it spams GameIsPaused = false and I can open the pause menu like normal but can;t see the mouse
Script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PauseMenu : MonoBehaviour {
public static bool GameIsPaused = false;
public GameObject pauseMenuUI;
//Update is called once per frame
void Update() {
Debug.Log(GameIsPaused);
if (Input.GetKeyDown(KeyCode.Escape))
{
if (GameIsPaused)
{
Resume();
} else
{
Pause();
}
}
}
public void Resume ()
{
pauseMenuUI.SetActive(false);
Time.timeScale = 0f;
GameIsPaused = false;
}
public void Pause ()
{
pauseMenuUI.SetActive(true);
Time.timeScale = 0f;
GameIsPaused = true;
}
}
The other thing I dont get is that when I try to click the buttons in the pause menu my mouse just disappears and I cant get the mouse back unless I close the pause menu (sec) and then reopen it
I just fixed that but when I pause the game while testing and try to press the button(Resume,Menu,Quit) my mouse just disappears and I cant get it back unless I unpause it then repause it
you only do it on start, and you only change it from unpaused to paused.
either change the cursor in the pause and resume functions or move this check to update and take the other case into account.