I have no idea what’s causing this, the culprit may not even be the script itself. I have a start menu as a separate scene that works fine, but when I hit start and enter my game, the pause screen is already there. Hitting escape or resume don’t make it go away. the quit button works as it should, but that’s it. On top of all that, my first person character is still able to move and look around while the game is “paused.” I’ve included my full pause menu script below. Thanks in advance for the help!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class PauseMenu : MonoBehaviour
{
public static bool GameIsPaused = false;
public GameObject pauseMenuUI;
// Update is called once per frame
void Update() {
if (Input.GetKeyDown(KeyCode.Escape))
{
if (GameIsPaused)
{
Resume();
} else
{
Pause();
}
}
}
public void Resume ()
{
pauseMenuUI.SetActive(true);
Time.timeScale = 1.0f;
GameIsPaused = false;
}
void Pause ()
{
pauseMenuUI.SetActive(true);
Time.timeScale = 0f;
GameIsPaused = true;
}
public void QuitGame()
{
Debug.Log("Landing...");
Application.Quit();
}
}