Good day, how to make a normal timer, for example, from 10 seconds to 0, and after finishing it started counting again from 10 to 0. I would be very grateful if you wrote the code, unity just started to learn. Tried to search on the Internet Unity constantly gives errors. I do in Unity 5.

  • one
    And where does the unit? The code is written in C# or javascript . write at the beginning on it, and then do with it whatever you want in the unit - Alexey Shimansky
  • C # code found that worked on the old version of the unit, now innovations came in version 5 of the unit. So I ask those who know, to help. - anarbus

1 answer 1

 float time = .0f; IEnumerator Timer () { time = 10.0f while (time > 0.0f) { time -= Time.deltaTime; yield return new WaitForFixedUpdate (); } Debug.Log ("done"); StartCoroutine (Timer()); yield return null; } 
  • Try to write more detailed answers. Explain what is the basis of your statement? - Nicolas Chabanovsky