Tag Info

New answers tagged

0

Your code wasn't formatted and structured well at all (bunch of if, else is never pleasant to read), so I decided to re-write everything and give you an example of how you are supposed to code in C#. To check if you are structuring your code well or not, you can check 2 things. 1) Your Game class needs to be less than 50-80 lines of code. 2) How easy would ...


1

Alternatively, you could use System.Timers.Timer which is probably the most performant of any solution. The following example shows a countdown for 100 seconds. System.Timers.Timer LeTimer; int BoomDown = 100; void Start () { //Initialize timer with 1 second intervals LeTimer = new System.Timers.Timer (1000); LeTimer.Elapsed += //This ...


1

Coroutines are you friend I think on this one... http://docs.unity3d.com/Manual/Coroutines.html Here is an example: void Start () { StartCoroutine ("Countdown", 10); } private IEnumerator Countdown(int time){ while(time>0){ Debug.Log(time--); yield return new WaitForSeconds(1); } Debug.Log("Countdown Complete!"); }



Top 50 recent answers are included