0
how can i create a pause menu and a return button script
like i want to create a pause menu and a return button but i don't know how to make the return button to retun on the same level where the user has just paused.
6 Respostas
+ 8
What code do you have so far? You should be able to to stop the time flow of the game and continue from the pause menu. Are you trying to exit that game and come back to it at a later time? If so you may need to have an auto saving method that saves at least the scene or information about the scene that can be accessed when returning. I'll need to see a bit of your code to know what your doing unless you can better portray what you're trying to do.
+ 7
So, for clarification, are you having trouble making the button, or are you having trouble making it come back from the pause, both? I know everything you wrote just need to know where you're going with it
+ 3
what does time.timescale do?
+ 2
public AudioSource[] audioSourcesToIgnore;
void Start(){
foreach(AudioSource snd in audioSourcesToIgnore){
snd.ignoreListenerPause = true;
}
}
//PauseGameScript.cs:
void OnGUI(){
if(pause){
Time.timeScale = 0.0f;
AudioListener.pause = true;
//all the other stuff you wanna do in your pause menu
}
else{
Time.timeScale = 1.0f;
AudioListener.pause = false;
}
}
+ 1
Time.timescale is the time of the game. 1 = normal and 0 = stopped time. You can use this to pause or use slow motion
0
If you dont undertand i will explain step by step. Just add a new answer and it will give me a notification