hello;
this code pauses the game.
if(GUI.Button (Rect (25, 100, 100, 30), "PAUSE")) {
Time.timeScale = 0;
}
my question is how do you on pause the game
the gui.button only takes one state
each time you click it
it pauses the game
hello;
this code pauses the game.
if(GUI.Button (Rect (25, 100, 100, 30), "PAUSE")) {
Time.timeScale = 0;
}
my question is how do you on pause the game
the gui.button only takes one state
each time you click it
it pauses the game
Maybe use a toggle button.
Anyways if you have one button thats always going to set the time scale to 0 its going to be “paused” to get your app going again you set the time scale to 1.0
Have you tried something like this?
if(GUI.Button (Rect (25, 100, 100, 30), "PAUSE")) {
Time.timeScale = 1.0 - Time.timeScale;
}
code worked perfectly…
thanks a lot
I would have never thought of doing that…
It pauses only timer for me and not the application. I have three buttons called " Yellow, beetle and pause". I also have timer on the screen. When I click on Yellow button, beetle moves from bottom to top. So when I click pause button I not only want to pause time, but also the beetle button should freeze.
I think update function is still running. And is there a way to freeze the whole application?
Thanks,
Any thoughts on this?
Hello!
The Time.timeScale only works on the FixedUpdate function, so if you want to propagate it to other functions you are going to need to use flags, or ask for Time.timeScale == 0.
hope it helps
Doing that just pauses time and I think I need to pause elements that are in action when I hit pause button. So it depends on game elements and there doesnt seem to be anything built in right now in unity like for freezing the scene.
Thanks ,
When you freeze time set a flag/variable.
In your GUI buttons only make them work when the flag is not set.