Question by
creed3709 · Nov 19, 2020 at 07:41 AM ·
pause menu
Hi guys, trying to pause my game:
Hi, I'm trying to pause my game and I've redone the script multiple times but nothing works. This is my current script:
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PauseMenuManager : MonoBehaviour {
public GameObject pauseMenu, pCamera;
public bool pauseMenuActive;
void Start()
{
pauseMenu.SetActive(false);
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
pauseMenuActive = !pauseMenuActive;
if (pauseMenuActive)
{
PauseMenuOpen();
}
if (!pauseMenuActive)
{
PauseMenuClose();
}
}
}
void PauseMenuOpen()
{
pauseMenu.SetActive(true);
Time.timeScale = 0;
}
public void PauseMenuClose()
{
pauseMenuActive = false;
pauseMenu.SetActive(false);
Time.timeScale = 1;
}
}
Someone help please!
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613020056im_/https://answers.unity.com/themes/thub/images/avi.jpg)
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