You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
529 B
28 lines
529 B
2 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using UnityEngine.InputSystem;
|
||
|
|
||
|
public class PauseMenu : MonoBehaviour
|
||
|
{
|
||
|
|
||
|
public GameObject pauseMenu;
|
||
|
private bool paused = false;
|
||
|
|
||
|
void Update()
|
||
|
{
|
||
|
if (Input.GetKeyDown(KeyCode.Escape))
|
||
|
{
|
||
|
paused = !paused;
|
||
|
}
|
||
|
if (paused)
|
||
|
{
|
||
|
pauseMenu.SetActive(true);
|
||
|
Time.timeScale = 0;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
pauseMenu.SetActive(false);
|
||
|
Time.timeScale = 1;
|
||
|
}
|
||
|
}
|
||
|
}
|