How to Hide the GUI when time.scale = 1 again

Hey guys, just a quick question, does anyone know how I could make my GUI dissapear again once the timescale is returned to 1, here’s the pause script:

using UnityEngine;
using System.Collections;

public class Pause : MonoBehaviour {

	public GUITexture movePause;
	public bool gamePaused = false;
	public GUISkin guiSkin;
	
	Rect windowRect = new Rect (0, 0, 620, 520);
	private bool toggleTxt = false;
	string stringToEdit = "Text Label";
	float hSliderValue = 0.0f;
	float vSliderValue = 0.0f;
	private float hSbarValuet;
	private float vSbarValue;
	private Vector2 scrollPosition = Vector2.zero;

	void  Start (){

		Time.timeScale = 1.0f;
	}

	void  Update (){

				windowRect.x = (Screen.width - windowRect.width) / 2;
				windowRect.y = (Screen.height - windowRect.height) / 2;

				foreach (Touch touch in Input.touches) {

						if (gamePaused == false) {
								if (movePause.HitTest (touch.position)) {
										gamePaused = true;
										Time.timeScale = 0.0f;
								} else {
										gamePaused = false;
										Time.timeScale = 1.0f;
								}
						}
				}
		}
				
				void OnGUI(){

		GUI.skin = guiSkin;
					
					if (gamePaused){
						windowRect = GUI.Window (0, windowRect, PauseMenu, "Paused");
					}
				}
				
	void PauseMenu(int windowPause) {
		
		if (GUI.Button ( new Rect(140,50,340,50), "Resume"))
		gamePaused = false;
		if (GUI.Button ( new Rect(140,120,340,50), "Restart"))
		Application.LoadLevel("TestScene1");
		GUI.Button ( new Rect(140,190,340,50), "Options");
		if (GUI.Button ( new Rect(140,260,340,50), "Main Menu"))
			Application.LoadLevel ("Menu");
		if (GUI.Button ( new Rect(140,330,340,50), "Quit"))
		Application.Quit ();
	}
}

Thanks in advanced!

The problem is your for loop:

foreach (Touch touch in Input.touches) {
	if(gamePaused == false){
		if(movePause.HitTest(touch.position)) {
			gamePaused = true;
			Time.timeScale = 0.0f;
		}else{
			gamePaused = false;
			Time.timeScale = 1.0f;
		}
	}
}

Once the game is paused if(gamePaused == false) will never return true so you can never get the point in your for loop where you unpause again:

Maybe try doing this instead:

foreach (Touch touch in Input.touches) {
	if(movePause.HitTest(touch.position)) {
		gamePaused = !gamePaused;
		Time.timeScale = 1.0f - Time.timeScale;
		break;
	}
}

on the first touch input it finds that makes movePause.HitTest(touch.position) true, it will set gamePaused to ‘not’ gamePaused (basically a toggle) and set Time.timeScale to 1-itself (toggles between 1 and 0).

Scribe