How to Make a Day-Night Cycle in UE5 Blueprints
A day-night cycle is one rotating light wearing a system’s clothes: drive a time-of-day value, map it to the sun’s pitch, and let UE5’s sky do the heavy lifting. The design decision is day length and whether gameplay reads the clock.
What it’s made of
Variables
TimeOfDay float (0–24 is the readable convention), DayLengthMinutes float, and a reference to the Directional Light (sun) — plus UE5’s Sky Atmosphere and Sky Light reacting automatically.
Events
Event Tick advances the clock: TimeOfDay += (DeltaSeconds / (DayLengthMinutes × 60)) × 24, wrapped with a modulo at 24. A dispatcher like OnHourChanged lets gameplay (shops, spawns, streetlights) subscribe.
The logic
Map TimeOfDay to sun pitch: (TimeOfDay / 24) × 360 + 90, fed into Set Actor Rotation on the Directional Light — that phase puts the sun on the horizon at 6:00, overhead at 12:00, and below the world at midnight. With Sky Atmosphere connected to the light, dawn/dusk color comes free. Streetlights and emissives listen for hour thresholds instead of polling.
Key nodes you’ll wire
The mistake that breaks it
Rotating the light by a fixed amount per tick instead of deriving rotation FROM TimeOfDay — framerate changes the length of your day, and save/load can’t restore the clock.
New to how Blueprint systems fit together? Read the anatomy of a Blueprint system first.
Or skip the wiring — generate it
BlueprintStudio builds this system from a plain-language prompt — the right nodes, exec and data pins wired, defaults set — and tells you whether it is ready to paste or what to set up first. The prompt is prefilled:
Build “Day-Night Cycle” in BlueprintStudioPrompt variations to try
Paste it into your Blueprint, or apply it with the free Cosindra desktop app (Windows & macOS).
Common questions
Why doesn’t the sky change when I rotate the sun?
Rotating a Directional Light alone just moves shadows. Dawn and dusk color need a Sky Atmosphere actor in the level and the light’s Atmosphere Sun Light flag enabled — then the sun angle drives sky color physically. For ambient light that follows along, set the Sky Light to Real Time Capture; otherwise interiors stay lit at midnight from a stale capture.
Is Event Tick acceptable for a day-night cycle?
Yes — this is one of the legitimate Tick jobs, because the clock genuinely advances every frame. The rule is to multiply by Delta Seconds so a 30 fps machine and a 144 fps machine live the same day length. What stays wrong is per-frame work that doesn’t need it: streetlights should subscribe to OnHourChanged, not poll TimeOfDay each tick.
How do I fire an event at a specific in-game hour?
Never compare the clock to 18.0 with an Equal (Float) node — the value skips over exact numbers between frames. Instead, Floor the TimeOfDay before and after each advance; when the two ints differ, the hour rolled over, so call OnHourChanged with the new hour. Subscribers Switch on Int to react at their own time — streetlights at 19, shops at 8.