- Home /
Question by
OllieParkes · Dec 11, 2011 at 01:42 AM ·
menupause
Pause menu scripting help?
Hi, i need help with the below script, with the GetButtonUp( script, how can you programme it so that you can input any button into it to be able to pause it?? (i would like to press the "P" button for it to work)
Thanks in advance.
var paused : boolean = false;
function Update () {
if(Input.GetButtonUp("Jump")){
if(!paused){
Time.timeScale = 0;
paused=true;
}else{
Time.timeScale = 1;
paused=false;
}
}
}
Comment
Best Answer
Answer by BiG · Dec 11, 2011 at 05:30 PM
You are simply using the wrong function. Just use
Input.GetKeyUp("p")
, instead that
Input.GetButtonUp("Jump")
So, your final script would be:
var paused : boolean = false;
function Update () {
if(Input.GetKeyUp("p")){
if(!paused){
Time.timeScale = 0;
paused=true;
}else{
Time.timeScale = 1;
paused=false;
}
}
}
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Script Not workin 1 Answer
Zelda like pause menu 1 Answer
Creating Pause Game Menu 1 Answer
Switching between one or more cameras in the same scene? 2 Answers