Hello, fellow Unity users. I am working on a memory match game. The game itself is about done, and I’ve been working on a clock. The clock and timer work. What I want to do is make a pop-up GUI with “Time Up” and a try again button. However, I am completely stumped. I have the following in the “TimeIsUp” function:
function TimeIsUp()
{
Debug.Log(“Time is up”);
}
My plan is to make a dialog pop up when the time is up, with a button taking the player back to the title screen. The problem is, however, that I don’t know how to do this, and I could use some assistance.
Thanks!
-Matt 
Ok well first you need to set up a variable to start counting down, then count down in Update and then check the timer also, I’ll write below
var timeLeft =20.0; //Change this to the length of time you want to count down from
function Update() //This function calls once a frame
{
timeLeft -= Time.deltaTime; //Here we are just subtracting the elapsed time from timeLeft
}
function OnGUI() //Used for all drawing of GUI
{
if(timeLeft<=0)
{
GUI.Box(Rect(0,0,Screen.width,Screen.height),""); //Background Box
if (GUI.Button(Rect(10,70,50,30),"Main Menu")) //Re-adjust the first 2 numbers for location and the second 2 for width and size
{ Application.LoadLevel ("Main Menu"); } //Loads up the main menu scene
}
}
Hope it helps
Myhi