how can i create a pause menu and a return button script | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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.

13th Apr 2017, 9:29 AM
Upendra Juneja
Upendra Juneja - avatar
6 Answers
+ 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.
14th Apr 2017, 3:42 AM
SoraKatadzuma
SoraKatadzuma - avatar
+ 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
16th Apr 2017, 8:35 PM
SoraKatadzuma
SoraKatadzuma - avatar
+ 3
what does time.timescale do?
14th Apr 2017, 4:46 AM
Edward
+ 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; } }
14th Apr 2017, 3:41 AM
Square Weber Interactive
Square Weber Interactive - avatar
+ 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
16th Apr 2017, 8:24 PM
Square Weber Interactive
Square Weber Interactive - avatar
0
If you dont undertand i will explain step by step. Just add a new answer and it will give me a notification
14th Apr 2017, 3:42 AM
Square Weber Interactive
Square Weber Interactive - avatar