So basically I followed a youtube tutorial to do my pause menu. But when I pause my game I can still move my camera around. Can someone help me, please?
This is my code:
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 ()
{
Debug.Log("Resume Is Working");
pauseMenuUI.SetActive(false);
Time.timeScale = 1f;
GameIsPaused = false;
}
void Pause ()
{
Debug.Log("Pause Is Working");
pauseMenuUI.SetActive(true);
Time.timeScale = 0f;
GameIsPaused = true;
}
public void LoadMenu()
{
Debug.Log("Load Is Working");
Time.timeScale = 1f;
SceneManager.LoadScene("Menu V3");
}
public void QuitGame()
{
Debug.Log("Quitting game...");
Application.Quit();
}
}