Simple error?

Hey all,
I’m trying to add a simple GUI Label that counts down from 240 seconds. So, I used this script:

var timer : int;
var timerMax : int = 240;
var guiTime = 240 - timer;
function Update () {
	
	timer += 1 * Time.deltaTime;
  if(timer >= timerMax){
     timer = 0;
     Application.LoadLevel("MainScene2");
   }
	
}

function OnGUI () {
	GUI.Box (Rect (400, 25, 100, 30), "Time remaining:", guiTime.ToString());
}

But for some reason, the only words appearing when I test it out are the words “Time remaining:”.

Any suggestions?

GUI.Box (Rect (400, 25, 100, 30), “Time remaining:”, guiTime.ToString());

should be:

GUI.Box (Rect (400, 25, 100, 30), “Time remaining:” + guiTime.ToString());

will get you to display something, but the Time.deltaTime in your function I’m not too sure about

Since timer is an int, it will never go above 0.

–Eric