- Home /
 
Countdown little help...!
Hi... I have this little script countdown timer.
var myTimer : float = 5.0;
  
               function Update () { if(myTimer > 0){ myTimer -= Time.deltaTime; } if(myTimer <= 0){ Debug.Log("GAME OVER"); Application.LoadLevel (1); } } 
I want also to show that countdown time on the top right corner of my screen. How can i do that? Just edit the script and show me how. Thank you.
Answer by denewbie · Nov 22, 2010 at 11:36 AM
var myTimer : float = 5.0;
 
               function Update () { if(myTimer > 0){ myTimer -= Time.deltaTime; } if(myTimer <= 0){ Debug.Log("GAME OVER"); Application.LoadLevel (1); } }
 
               function OnGUI(){ GUI.Label( Rect(Screen.width - 200, 0, 200, 30), "Time: " + myTimer );
 
               } 
 
              Thanks^^. JS is tough for me cause I converted to C# half a year ago. The my backend engines are in java... These days I'm just confused with all the syntax...
Hey guys, I used this script too - btw, thanks for it. but how can I change fonts on the timer?
Your answer