using UnityEngine; using TMPro; public class DigitalWatch : MonoBehaviour { public TextMeshProUGUI timeText; void Start() { InvokeRepeating("UpdateTime", 0f, 1f); // Update time every second } void UpdateTime() { string currentTime = System.DateTime.Now.ToString("hh:mm tt"); // Get current time in the desired format timeText.text = currentTime; // Update the TextMeshPro component with the current time } }