I'm trying to make a countdown timer in Unity, and I've been able to make the timer count down from 10. However, I can't stop it at 0. I've tried putting it in a while loop but it didn't help, it actually made the timer start at 0.
float counter = 10.0f; public TextMesh countdown; void Start () { countdown = gameObject.GetComponent<TextMesh>(); } void Update () { counter -= Time.deltaTime; countdown.text = "Time Left:" + Mathf.Round(timeLeft); if (counter <= 0) { Debug.Log("Hello"); } }