Your Cart
Loading
unity analog clock tutorial how to make analog clock in unity

Unity Analog Clock Tutorial

In this video tutorial, we'll guide you through creating a stunning analog clock in Unity! We'll start with the graphics setup, showing you how to design the clock face and hands using Unity's UI tools. Then, we'll dive into script writing, where you'll learn to implement real-time functionality to keep your clock ticking accurately.



WATCH FULL TUTORIAL ON YOUTUBE


CHECK OUR PROJECTS


SUBSCRIBE FOR LATEST OFFERS



=========================================================


3 Unity Projects Only $70 - ON SALE!!!!


1. Water Sort 9000 Levels

https://payhip.com/b/cjDb8


2. Ball Sort Sort 9000 Levels

https://payhip.com/b/IbtoD


3. Sling Shot 250 Levels

https://payhip.com/b/PjLDH


Contact: unitycoderz2022@gmail.com


=========================================================



Script:


AnalogClock.cs


using System.Collections;

using System.Collections.Generic;

using UnityEngine;


public class AnalogClock : MonoBehaviour

{

  public RectTransform hourHand;

  public RectTransform minuteHand;

  public RectTransform secondHand;


  // Update is called once per frame

  void Update()

  {

    System.DateTime time = System.DateTime.Now;


    float seconds = time.Second;

    float minutes = time.Minute + seconds / 60f;

    float hours = time.Hour % 12 + minutes / 60f;


    secondHand.localRotation = Quaternion.Euler(0, 0f, -seconds * 6f);

    minuteHand.localRotation = Quaternion.Euler(0, 0f, -minutes * 6f);

    hourHand.localRotation = Quaternion.Euler(0, 0f, -hours * 30f);

  }

}





DOWNLOAD CODESTER FILES