A lightweight and easy-to-use timer system for Unity, designed with flexibility, performance, and simplicity in mind. Automatically managed and lifecycle-safe, ideal for gameplay logic, delays, cooldowns, and more.
- ⏳ Create simple or looping timers
- ✅ Automatically managed by
TimerManager - 🧰 A custom inspector on
TimerManagerfor debugging purposes - 🔁 Loop support with customizable amount
- 🛑 Pause and resume support
- 🧠 Callback events for:
- Tick updates
- Timer completion
- Cycle/loop transitions
- Pause/resume/kill lifecycle
- Clone or download and unzip the folder into your Unity project.
- Done!
TimerManagerwill automatically bootstrap on game start.
new Timer(5f, "MyTimer")
.SetOnTimerTick(() => Debug.Log("Tick..."))
.SetOnTimerFinish(() => Debug.Log("Timer finished!"))
.SetLooping(3); // Optional: loops 3 timesTimerManagerruns automatically (via[RuntimeInitializeOnLoadMethod]) and updates all active timers every frame.- Timers are automatically removed once they are finished or killed.
- You can pause, resume, or kill any timer at any time.
| Property / Method | Description |
|---|---|
IsPaused |
Whether the timer is currently paused |
IsFinished |
Whether the timer has been finished |
RemainingSeconds |
Time remaining in the current cycle |
TotalDuration |
Total time for one cycle |
LoopAmount |
How many times to loop (-1 = infinite) |
Tick(float deltaTime) |
Advance the timer by deltaTime |
Pause() / Resume() |
Pause or resume the timer |
Finish() / Kill() |
Complete or force remove the timer |
SetOnTimerTick(Action) // Called every tick
SetOnTimerFinish(Action) // Called when timer completes
SetOnTimerLoop(Action) // Called when a loop starts
SetOnTimerCycleEnd(Action) // Called when a cycle ends
SetOnTimerPause(Action) // Called on pause
SetOnTimerResume(Action) // Called on resume
SetOnTimerKill(Action) // Called on manual kill
SetLooping(int loopAmount = -1) // Set loop count (-1 = infinite)- Keeps a list of active timers.
- Automatically updates them every frame.
- Removes completed or killed timers.
public IReadOnlyList<Timer> Timers { get; }void Start()
{
var myTimer = new Timer(3f)
.SetOnTimerTick(() => Debug.Log("Ticking"))
.SetOnTimerFinish(() => Debug.Log("Boom!"));
}MIT License — see LICENSE for full terms.
Gabriel Bigardi
Game developer and tools programmer
Discord: gabrielbigardi
Twitter: @BigardiGabriel
Email: gabrielbigardi@hotmail.com
