I have started creating a Pause menu however i am stuck creating the unpause menu button for my pause menu. I have tried everything. I have looked all over google and Unity and i couldnt find a working solution/script.
Here is my Pause menu script, It is not finished yet but this is where i have got to until i need to create my resume game button:
var mainMenuSceneName : String;
private var pauseEnabled = false;
function Start(){
pauseEnabled = false;
Time.timeScale = 1;
AudioListener.volume = 1;
Screen.showCursor = 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
pauseEnabled = false;
Time.timeScale = 1;
AudioListener.volume = 1;
Screen.showCursor = false;
}
//else if game isn't paused, then pause it
else if(pauseEnabled == false){
pauseEnabled = true;
AudioListener.volume = 0;
Time.timeScale = 0;
Screen.showCursor = true;
}
}
}
function OnGUI(){
if(pauseEnabled == true){
if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 ,250,50), "Options")){
if(pauseEnabled == true){
//unpause the game
pauseEnabled = false;
Time.timeScale = 1;
Screen.showCursor = false;
}
}
}
Please can you tell me how to fix my script because i am getting a error saying that it is expecting “{” instead it found ". I have no idea how to fix it.
Can you please post a basic resume game button for my script that will work (My script it written in Javascript)
Or
Can you give me the code for a resume game and i can implement the code into my script.
Thanks in advanced.
UniqueGaming