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?