How do you get a countdown timer to actually count down? (C# Script)
I'm pretty new to coding as I am studying it while in education, I found a code on how to create a countdown timer, but when I apply it to a canvas, no timer shows up. However, if i put the code into the Main Camera, the timer shows up but does not count down.
This is the code I am using.
int timer = 0;
void OnGUI(){ int minutes = Mathf.FloorToInt (timer / 60F); int seconds = Mathf.FloorToInt (timer - minutes * 60); string niceTime = string.Format ("{0:0}:{1:00}", 2, 30);
GUI.Label (new Rect (10, 10, 250, 100), niceTime);
}
I am thankful for any help!
Comment
Your answer
Follow this Question
Related Questions
Perform action If Input is done in this time. 2 Answers
How do I stop my timer by accessing a variable from another script? 2 Answers
Editable Timer 0 Answers
Start and Stop Timer Help 1 Answer