using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; public class Countdown : MonoBehaviour { public TextMeshProUGUI countdownText; [SerializeField] public float remainingTime; /// /// This code updates the countdown timer, displaying the remaining time in minutes and seconds on the UI text component. /// private void Update() { remainingTime -= Time.deltaTime; int minutes = Mathf.FloorToInt(remainingTime / 60); int seconds = Mathf.FloorToInt(remainingTime % 60); if (countdownText != null) { countdownText.text = string.Format("{0:00}:{1:00}", minutes, seconds); } } }