I’ve got a script that hides my mouse cursor until the pause menu is brought up. My problem is that once the player brings up the pause menu, then hits the “Resume” button, the cursor does not go away again. I assume there would be some command to say “if gui button “resume”, Screen.showCursor = false;” However, I am not an experienced progammer. Any suggestions would be greatly appreciated. Here’s the code I currently have:
private var showingCursor = false;
function Start(){
Screen.showCursor = false;
}
function Update(){
//check if pause button (escape key) is pressed
if(Input.GetKeyDown("escape")){
//check if game is already paused
if(showingCursor == true){
Screen.showCursor = false;
showingCursor = false;
Time.timeScale = 1;
AudioListener.volume = 1;
}
//else if game isn't paused, then pause it
else if(showingCursor == false){
Screen.showCursor = true;
showingCursor = true;
Time.timeScale = 0;
AudioListener.volume = 0;
}
}
}