- Home /
how do you make an interactive pause menu?
I am a beginner and im wanting to make a pause menu you that the player can interact with just like the main menu. i want there to be a "quit game" "save game" and "resume" button. this is the script i have so far. the script works but you can still move your head around in the game it disables the moving of the character though. i need help stopping the camera from moving when paused, and itd be helpful if you could suggest how i make the menu interactive like i want them to quit from the pause?
SCRIPT:
var pause : boolean = false;
var pauseGUI : GUITexture;
pauseGUI.enabled = false;
function Update(){
if(Input.GetKeyUp(KeyCode.Escape)) {
if(pause==true){
pause = false;
}
else {
pause = true;
} if(pause == true) {
Time.timeScale = 0.0;
pauseGUI.enabled = true;
}
else {
Time.timeScale = 1.0;
pauseGUI.enabled = false;
}
}
}
END:
Docs recommend :
If you lower timeScale it is recommended to also lower Time.fixedDeltaTime by the same amount.
FixedUpdate functions will not be called when timeScale is set to zero.
If you still need access to these functions, make the timescale very very small but not 0.
Answer by Kiwasi · Aug 05, 2014 at 07:50 PM
var pause : boolean = false;
function Update(){
if(Input.GetKeyUp(KeyCode.Escape)) {
pause = !pause;
if (pause){
Time.TimeScale = 0;
} else {
Time.TimeScale = 1;
}
}
}
function OnGUI (){
if(pause){
// Write your GUIButtons for the pause menu here
}
}
Making the camera movement stop is simply a case of making sure your camera movement script relies on Time.deltaTime.
thanks for the script help but there's a problem its doesn't seem to work i've attached it to the FPC but it doesnt work i then tried a GUI texture but it doesnt work
Your answer
![](https://koobas.hobune.stream/wayback/20220613155909im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
c#help reversing a script 1 Answer
New to Unity, Need Help. 1 Answer
Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers
function Start () problem!! 3 Answers