Example: Sky Rotator
UE5 Time of Day Blueprint System Version: 2.0The BP_TimeOfDay_SkyRotator example found in the Blueprints/Utilities/ folder can be used to rotate 2 directional lights at the same time in your level which gives the visual appearance of a day and night cycle.
Setup the Sky Rotator
To use the Sky Rotator just drop it in your level. It will automatically detect your time of day and your directional lights. You will also need 2 directional lights in your level. The one with the highest intensity is the one that the system will set as your Sun, and the one that will appear directly overhead at noon. The other light will be assigned as your Moon.
If you are using a Sky Sphere BP it also needs to support showing both directional lights or you will not see the moon in your sky, even though the light still appears to work. By default the one included with a new Unreal level will only show the Sun. In the demo world we removed the sky sphere bp that comes with a new level.
One other thing you will want to make sure of is that the directional light for your moon has an Atmosphere Sun Light Index of 1. By default it will be set to 0, which is the one your sun is also using. Unfortunately this is not something I can change for you at runtime, so it is something you will need to account for in your level.
You should only ever need one BP_TimeOfDay_SkyRotator in your level. It will only use the first one detected, and will prune the extras. If an extra is detected you will see a print string warning you.
Configure the Sky Rotator
After you set up the sky rotator and get it working in your level there are a number of options you can explore to further customize it. Select the BP_TimeOfDay_SkyRotator in your level then navigate the details panel to the Default section.
Most Common Issues
This is most likely a result of your level having a Sky Sphere BP in your level that does not support showing multiple discs in the sky. The default one included with Unreal will only show your sun, and not your moon. To resolve, use a valid Sky Sphere that supports both directional lights, or remove the Sky Sphere from your level.
The most likely cause for this is that your Moon’s directional light is using the same default Atmosphere Sun Light Index as your Sun’s Directional Light. To fix this select your Moon directional light, then from the details panel set the Atmosphere Sun Light Index to 1 if it is set to 0.
The most likely cause is that your SunPositionAtMidnight and MoonPositionAtMidnight are not exactly 180 degrees apart. By default the Sun is set to -90 and the Moon is 90, the difference between the two is 180. If you changed your Sun to -80 then your Moon will need to be 100 to have no point of complete darkness.
First confirm that time is actually working in your level. If it is and the issue is just the sky rotator then the most likely cause is that you disabled ChangeSkyOnServer? this setting should only be set to false with multiplayer games that use a dedicated server.
If your project is single player or you are using a listen server (where the server is also one of your players) set this variable to true if it is currently set to false. The only other possibilities would be if your BP_TimeOfDay was removed from your level, or your UpdateSkyRotationSpeed on the BP_TimeOfDay_SkyRotator was changed to 0 (default is 0.1). If it is none of these check the settings on your directional lights.
Keep in mind the Sky Rotator is only going to rotate your Directional Lights, it will not set up or add missing environmental related lighting actors. Keep in mind your lighting does need to be configured to get the full affect out of this utility. Use the "Env. Light Mixer" under the Window menu to add missing lighting related actors to your level. For example if you are missing the Sky Atmosphere from your level, you will not have a good end result.
If you need it, the Demo world is also included and fully configured for the Sky Rotator. You can compare the modified settings of it and the lighting related actors to the ones in your project to see if you are missing anything.