Digital Clock in unity full tutorial

Subscribers:
1,110
Published on ● Video Link: https://www.youtube.com/watch?v=kR-lkdUwv_I



Category:
Tutorial
Duration: 3:35
73 views
8


Code :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class DigitalClock : MonoBehaviour
{
public Text hoursText, minutesText, secondstext;
public int seconds, minutes, hours;

// Start is called before the first frame update
void Start()
{
StartCoroutine(ChangeTime());
}


IEnumerator ChangeTime()
{
yield return new WaitForSeconds(1f);

seconds++;
if (seconds==60)
{

seconds = 0;
minutes++;

if (minutes==60)
{
minutes = 0;
hours++;
hours = hours % 12; //////// or hours=hours%24;
}

}

hoursText.text = "" + hours;
minutesText.text = "" + minutes;
secondstext.text = "" + seconds;

StartCoroutine(ChangeTime());
}
}



About Music Track:
Name Track: Cinematic Suspense Trailer
Music by: Soundridemusic
Link to Video: https://youtu.be/eQTtfMgz4Ow




Other Videos By Muhammad Shahzaib


2022-08-29Develop sun in unity3d | Add custom sun in unity3d | Lens flare in unity3d
2022-08-28Enable hinge joint and car door physics on collision unity3d | Simple car hit effect in unity3d
2022-08-27GTA like car doors effect in unity3d | Unity door physics | Hinge joint in unity
2022-08-24Wind Zone in unity | Bend trees using wind zone in unity | How to add trees on terrain
2022-08-23Simple waypoint follow AI in unity | Patrolling AI in unity3d | Waypoint system unity
2022-08-21Add 3D Text in unity3D
2022-08-21Change default editor in unity
2022-08-17Auto adjust Ui elements in grid Unity | Grid Layout group unity
2022-08-16Auto adjust ui elements in a column unity | Vertical Layout group in unity
2022-08-12Analog Clock in unity3d demo with ticking ASMR
2022-08-09Digital Clock in unity full tutorial
2022-08-09UI elements infinite rendering bug and solution
2022-08-08Beautiful waterfall in Karachi
2022-08-07Add trail to bullets in unity3d step by step easy tutorial | #Trail Renderer in unity
2022-08-05Shoot bullet in unity easy tutorial | Tap input | Destroy bullets
2022-08-03Different ways to move in unity3d Part2 | MoveTowards and lerp in unity
2022-08-02Differnt ways to move in unity3d part1 (Simplw ways) | Take input in unity
2022-07-31Develop Realsitic Street Light In unity easy tutorial
2022-07-31Target indicator in unity easy tutorial
2022-07-28Add SlowMo in unity game tutorial | Game Pause logic
2022-07-27Save and Load Data using "Player Prefs" Unity easy tutorial



Tags:
unity
unity3d
unity2d
learn unity
unity tutorials
digital clock in unity
clock in unity
develop digital clock in unity