//Jimmy Vegas Unity Tutorial //This script is for pausing using System.Collections; using System.Collections.Generic; using UnityEngine; public class PauseGame : MonoBehaviour { public bool gamePaused = false; public AudioSource areaBGM; public GameObject pauseScreen; void Update() { if (Input.GetButtonDown("Pause")) { if (gamePaused == false) { Time.timeScale = 0; gamePaused = true; areaBGM.Pause(); pauseScreen.SetActive(true); } else { pauseScreen.SetActive(false); areaBGM.UnPause(); gamePaused = false; Time.timeScale = 1; } } } }