I"m trying to make a pause menu for my game but I don"t really understand how to make the game actually stop, I"ve looked into timescale but I don"t really understand how to make it work. I want it to have buttons that will allow the player to resume the game, look at options or credits, and to quit to the main menu. I"m using C#, and I haven"t found any tutorials that really explain how to create a pause menu. I already looked that the carolannpeacock.com communities pause menu but that didn"t really help.

You are watching: How to make a pause menu in unity

kc01 · Aug 13, 2014 at 07:03 AM 0

How would I be able to make it so it goes back to main menu as another button, my scene 0 is my main menu, scene 1 loading screen, and scene 2 is the actual game.

TheDDestroyer12 · Jan 06, 2015 at 02:37 PM 0

Go back to the main menu by calling Application.LoadLevel(0). Change 0 to the index of the level you want.


a very simple example:

using System; using carolannpeacock.comEngine; public class pause : MonoBehaviour { bool paused = false; void Update() { if(Input.GetButtonDown("pauseButton")) paused = togglePause(); } void OnGUI() { if(paused) { GUILayout.Label("Game is paused!"); if(GUILayout.Button("Click me to unpause")) paused = togglePause(); } } bool togglePause() { if(Time.timeScale == 0f) { Time.timeScale = 1f; return(false); } else { Time.timeScale = 0f; return(true); } } }

supamigit · Jun 06, 2014 at 10:14 AM 0
Works like a charm and if you add more buttons you can pause, restart by calling a scene, quit by calling Application.Quit call and its in C# finally.. Nice poster


I don"t really know that much about C#, I"m more into JavaScript.

But, you could set it so that when your game is meant to be paused, just set the Time.timescale to 0 like this: Time.timeScale == 0.0F. (That is in C# by the way).Then just go Time.timeScale == 1.0F to set it back to normal.

See more: So, Is Civil Rights Movement Capitalized Ap Style? Talk:Civil Rights Movement/Archive 9

Alternatively, if you"re having a lot of trouble, I made a pause menu in JavaScript that you can download for free of the Asset Store.

It doesn"t have a credits button, but it has a main menu button, but I"m sure that if you are OK with scripting, you could edit it!!!!!!!!!!!!!

Here is the link: http://u3d.as/content/grady-featherstone/pause-menu/1Zg

Also, you may like to check this out: http://carolannpeacock.com3d.com/support/documentation/ScriptReference/Time-timeScale.html

It is the script reference for Time.timescale!

But here is a simple example in JavaScript on how you might stop the game when the escape button is pressed, and then unpause it:

private var pauseEnabled = false;function Update(){

//check if pause button (escape key) is pressed if(Input.GetKeyDown("escape")){ //check if game is already paused if(pauseEnabled == true){ //unpause the game Time.timeScale = 1; } //else if game isn"t paused, then pause it else if(pauseEnabled == false){ Time.timeScale = 0; } } }