Unity Digital Clock | Unity Tutorial
In this video tutorial, we'll guide you through the process of creating a digital clock using Unity. You'll learn how to set up a real time clock, design a user-friendly interface, and implement scripts to display the current time.
WATCH FULL TUTORIAL ON YOUTUBE
=========================================================
3 Unity Projects Only $50 - ON SALE!!!!
Contact: unitycoderz2022@gmail.com
=========================================================
Script:
DigitalClock.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class DigitalClock : MonoBehaviour
{
public Text clockText;
// Start is called before the first frame update
void Start()
{
StartCoroutine(UpdateClock());
}
IEnumerator UpdateClock()
{
while (true)
{
System.DateTime now = System.DateTime.Now;
clockText.text = now.ToString("hh:mm:ss tt");
yield return new WaitForSeconds(1);
}
}
}