using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class pause : MonoBehaviour
{
public static bool GameIsPaused = false;
public GameObject pauseMenuUI;
void Update(){
if (Input.GetKeyDown(KeyCode.Escape))
{
if (GameIsPaused)
{
Resume();
} else
{
Pause();
}
}
}
void Pause()
{
pauseMenuUI.SetActive(true);
//Time.timeScale = 0f;
GameIsPaused = true;
}
public void Resume ()
{
pauseMenuUI.SetActive(false);
//Time.timeScale = 1f;
GameIsPaused = false;
}
public void LoadMenu()
{
//Time.timeScale = 1f;
SceneManager.LoadScene("new menu");
}
public void QuitGame()
{
Application.Quit();
Debug.Log("QUIT");
}
}
i have a script for a escape menu. i used this tutorial
but when i hit ‘esc’ i can still play my game in the background, can someone sugegst a fix. im guessing its in the top part of the code.
thanks