- Home /
Unity Pause Menu Still Has Camera Movement!
Recently I made a pause menu it works brill, but one problem when I move the mouse the camera moves anyway to resolve that? Here is the script.
var mainMenuSceneName : String; var pauseMenuFont : Font; private var pauseEnabled = false;
function Start(){ pauseEnabled = false; Time.timeScale = 1; AudioListener.volume = 1; Screen.showCursor = false; }
function Update(){
if(Input.GetKeyDown("escape")){
if(pauseEnabled == true){
//unpause the game
pauseEnabled = false;
Time.timeScale = 1;
AudioListener.volume = 1;
Screen.showCursor = false;
}
else if(pauseEnabled == false){
pauseEnabled = true;
AudioListener.volume = 0;
Time.timeScale = 0;
Screen.showCursor = true;
}
}
}
private var showGraphicsDropDown = false;
function OnGUI(){
GUI.skin.box.font = pauseMenuFont; GUI.skin.button.font = pauseMenuFont;
if(pauseEnabled == true){
GUI.Box(Rect(Screen.width /2 - 100,Screen.height /2 - 100,250,200), "Pause Menu");
if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 - 50,250,50), "Main Menu")){
Application.LoadLevel(mainMenuSceneName);
}
//Make Change Graphics Quality button
if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 ,250,50), "Change Graphics Quality")){
if(showGraphicsDropDown == false){
showGraphicsDropDown = true;
}
else{
showGraphicsDropDown = false;
}
}
if(showGraphicsDropDown == true){
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 ,250,50), "Fastest")){
QualitySettings.currentLevel = QualityLevel.Fastest;
}
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 + 50,250,50), "Fast")){
QualitySettings.currentLevel = QualityLevel.Fast;
}
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 + 100,250,50), "Simple")){
QualitySettings.currentLevel = QualityLevel.Simple;
}
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 + 150,250,50), "Good")){
QualitySettings.currentLevel = QualityLevel.Good;
}
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 + 200,250,50), "Beautiful")){
QualitySettings.currentLevel = QualityLevel.Beautiful;
}
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 + 250,250,50), "Fantastic")){
QualitySettings.currentLevel = QualityLevel.Fantastic;
}
if(Input.GetKeyDown("escape")){
showGraphicsDropDown = false;
}
}
if (GUI.Button (Rect (Screen.width /2 - 100,Screen.height /2 + 50,250,50), "Quit Game")){
Application.Quit();
}
}
}
Help Needed.
Answer by haim96 · Mar 12, 2014 at 05:08 PM
is this FPS camera? you can check if game is in pause mode and enable movement only if it's false.
you should put this in the camera control script.
any way, you should know that any object that doesn't depend on time to move wan't be effected by time.timescale=0
. (like for example time.deltatime * speed
)
let me know if you need more help with this. if not, please close the question by selecting an answer. thanks!
Your answer
Follow this Question
Related Questions
(JS) Touch pause menu issue 1 Answer
Restart Problem 1 Answer
Pause menu... Isn't pausing everything... 1 Answer
How to save players position then load a level (pause menu) 2 Answers
In-Game GUI menu. 2 Answers