Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Pause : MonoBehaviour
- {
- public bool IsPaused;
- public GameObject PauseMenu;
- void Start()
- {
- }
- void Update()
- {
- if (IsPaused)
- {
- PauseMenu.SetActive(true);
- Time.timeScale = 0f;
- }
- else
- {
- PauseMenu.SetActive(false);
- Time.timeScale = 1f;
- }
- if (Input.GetKeyDown(KeyCode.Escape))
- {
- IsPaused = !IsPaused;
- }
- }
- }
Add Comment
Please, Sign In to add comment