var paused : boolean = false;
function Update () {
if(Input.GetButtonUp(“Jump”)){
if(!paused){
Time.timeScale = 0;
paused=true;
}else{
Time.timeScale = 1;
paused=false;
}
}
}
When i enter Space, i can see that Pause getting off and on…
but it wont pause the game why?
Are you using Time.deltaTime to make things frame rate independent? If you are not, then Time.timeScale won’t have any effect.
Try Time.timeScale = 0.0; and 1.0. It probably isn’t the problem, but it is still useful as a reminder of when you are using a float.
it doesnt looks like you ever define that the game is paused
if space is entered, then paused = true
then if paused = true timescale = 0
Pat_sommer?
Look at the code again
var paused : boolean = false;
function Update ()
{
if(Input.GetButtonUp("Jump")) // When the Jump key is push up. then
{
if(!paused) // if paused = false, as it is then
{
Time.timeScale = 0; // set timescale to 0
paused=true; //set paused to true
}
else //If u push the Jump button and the pause is true, then
{
Time.timeScale = 1; // Set timescale to 1
paused=false; // set paused to false
}
}
}
Are U srs pat_sommer that U cant see that paused have been define``?
sry not to much experience with bools was confused on the layout
also this 2nd version is much better and more clearly formatted , and your the one with the non working script no need to be rude
my pause script works fine in my game