using TMPro; using UnityEngine; public class TimerNew : MonoBehaviour { public TextMeshProUGUI timerText; public float time = 120f; // 2 minutes void Update() { if (time > 0) { time -= Time.deltaTime; time = Mathf.Max(time, 0); } int minutes = Mathf.FloorToInt(time / 60); int seconds = Mathf.FloorToInt(time % 60); timerText.text = string.Format("{0:00}:{1:00}", minutes, seconds); } }