This question was
closed Dec 01, 2015 at 02:48 PM by
Dave-Carlile for the following reason:
Duplicate Question - http://answers.unity3d.com/questions/1105971/why-does-timescale-not-work.html
Question by
jurgendekker · Dec 01, 2015 at 02:41 PM ·
timepausetimescalepause menu
why doesn't timescale work?
I've made a game with a pause menu, so if the you press "p" there is a pause menu. but the problem is that the game itself not pauses. I don't know how to fix it. Here is my script:
using UnityEngine;
using System.Collections;
public class PauseMenu : MonoBehaviour {
public GameObject PauseUI;
private bool paused = false;
void Start(){
PauseUI.SetActive(false);
}
void Update(){
if (Input.GetKeyDown(KeyCode.P)){
paused = !paused;
}
if(paused){
PauseUI.SetActive(true);
Time.timeScale = 0;
}
if(!paused){
PauseUI.SetActive(false);
Time.timeScale = 1;
}
}
}
Comment