Creating a pause screen and resuming gameplay?
How would I go about creating a basic pause screen? All I want is when the player presses 'P' to overlay 3 buttons (but keep the game in the background, frozen) 'Resume', 'Quit Game', 'Main Menu'. I would also want it to say if the user presses 'Resume' to load the game back to where it was.
Edit: Just to clear it up, I want to have the 3 buttons overlay the game that is playing currently and freeze the game in the background)
bool pause;
if(pause button pressed)
{
pause =!pause;
}
if(pause){
time.timescale=0;
}
if(!pause){ time.timescale=1;
}
Answer by Veerababu.g · Jan 20, 2016 at 06:07 AM
bool pause;
if(pause button pressed){ pause =!pause; } if(pause){ time.timescale=0; } if(!pause){ time.timescale=1; }
Would you $$anonymous$$d formatting that? It's all bunched together and difficult to interpret.
Answer by dhore · Jan 20, 2016 at 06:41 AM
I haven't had a chance to check it out yet, but the other day I came across this menu system template made by the Unity Devs. It'll probably give you everything that you need.
Also, as @Veerababug mentioned above, you should be able to use time.timescale to pause the game in the background.