enter code here
ok so i have this script where i need to have my player stop moving and stop looking around when i press “p” and this brings up a pause menu.
var gamePaused : boolean = false;
function Update () {
if(Input.GetKeyDown("p")){
if(gamePaused){
Time.timeScale=1.0;
gamePaused = false;
}else{
Time.timeScale = 0.0;
gamePaused = true;
}
}
}
function OnGUI(){
if(gamePaused){
if(GUI.Button(Rect(450, 170, 100, 30), "Quit")){
Application.Exit();
}
if(GUI.Button(Rect (450, 100, 100, 30), "Resume")){
Time.timeScale = 1.0;
gamePaused = false;
}
if(GUI.Button(Rect(450, 135, 100, 30), "Options")){
if(GUI.Button(Rect(450, 180, 100, 30), "Options")){
}
}
}
}