Controlling the time using Day Sequence Plugin

Hello,

I’m learning UE5 to use for interactive visualization & environmental design.

I started experimenting the the DaySequence plugin to make the day/night cycle easily integrated on my design.

I’m looking for a method to allow for the player to be able to change the time of day with a press of a button, either by selecting a time from or a list or select a period like “Dawn” or “Noon”.

if anyone can share a method or a blueprint that can achieve that effect, I would be appreciative.

On FAB, there is a very good asset called UltraDynamicSky for the day-night cycle. I am currently using it for the day-night cycle and weather control in my project. It has a complete time control and environmental simulation system. If you purchase it, you won’t regret it. This is not an advertisement; it’s just my personal experience.

Day Sequence already has this, you don’t need to drive the sequence yourself. The Day Sequence Actor has a Blueprint node called Set Time Of Day that takes hours, 0 to 24.

A simple setup:

  1. In your player controller or your UI widget, get the actor with Get Actor Of Class (DaySequenceActor) on Begin Play and keep it in a variable.
  2. Make a Map variable, Name to Float, with your periods in it: Dawn 6, Noon 12, Dusk 18.5, Night 23, whatever hours suit your sequence.
  3. On the key press, or the On Clicked of a button in your widget, Find the period in the map and pass the hours into Set Time Of Day.
  4. If the time should stay where the player put it, call Pause on the actor right after. Play carries on the cycle from there.

For a list of exact times, a Combo Box works the same way, just convert the selected option to a float. Get Time Of Day gives you the current hour if you want to show it on screen.

Two things that catch people. Set Time Of Day is server only, so in multiplayer call it on the server (single player is fine). And if you want a fast-forward instead of a jump, Set Play Rate speeds up the whole cycle (2.0 makes a day take half as long), then set it back to 1 once Get Time Of Day reaches the hour you want.