UGTK cat mascotUGTKengine within an engine Request access

UGTK / Toolkit / Utility Systems / Timing System Completed

Utility Systems — UGTK

Timing System

Summary

A configurable timer that counts up, down or up-without-limit, exposes hours/minutes/seconds/tenths components (int and zero-padded strings), and fires UnityEvents on start, update, end, at specific thresholds and at repeating intervals. Ready-made UI prefabs bind the running clock to TextMeshPro labels through the TextUpdater System, with no code required.


Content


Modules Dependencies

The Timing System module requires the following dependencies:

Ensure that these dependencies are correctly imported and configured in your project.


Setup

To set up the Timing System, follow these steps:

Add the Mn_Timer component to a GameObject (or drop the plain TimeObject prefab):

Or add one of the ready-made UI prefabs under a Canvas: TimeObjectUi_AllSeconds shows the total seconds, TimeObjectUi_Minutes_Seconds shows an MM:SS clock (both auto-start, 60s countdown; the TextUpdater children bind by variableName to allSeconds, minutesStr2, secondsStr2...):

Configure the timer: set the Duration (seconds), pick the Direction (Ascending 0→duration, Descending duration→0, AscendingUnlimited never ends) and enable Trigger On Awake to auto-start. The Time Components fields are read-only mirrors of the running clock:


How To Use

  1. Wire the base events: OnTimerStart, OnTimerUpdate(float) (every frame with the current time) and OnTimerEnd (at the duration bound; never fired in AscendingUnlimited).

  2. Add Threshold Events (each fires once when its time value is crossed) and Interval Events (each fires at every multiple of its step, in both counting directions):

  1. Control it from the inspector or from code — the custom inspector has the Runtime Controls Play / Pause / Stop / Restart buttons (Play Mode only, multi-selection supported):

    mn_Timer.StartTimer();
    timeLabel.text = mn_Timer.GetFormattedTime();

Testing Scene

Open Debug/TimerScene.unity and press Play: the three timers auto-start — the two UI widgets count down from 60 (total seconds on top, MM:SS below) and the plain TimeObject runs logic-only. Select one and use the Runtime Controls to pause/reset/restart it:


Technical Info

The following are the main scripts of the Timing System:

Scripts:

Prefabs:


© 2026 Marcello De Bonis. All rights reserved

Real dependenciesOpen in the map →

Measured from the repository: code references (asmdef) plus prefab and asset GUIDs. Importing this module alone brings in 2 modules in total.