UE5 Time of Day Blueprint System
This page is part of the documentaiton for my UE5 Time of Day Blueprint System

Example: Sky Rotator

UE5 Time of Day Blueprint System Version: 2.0

    The 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.

    Are you trying to rotate your sky using Ultra Dynamic Sky? I created a short video tutorial that will guide you through creating a new Time of Day utility that rotates your Ultra Dynamic Sky based on the current time from my system.

    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.

    SkyRotationPath This is the path that your Sun and Moon will follow across the sky. This is the Z (Yaw) value of the rotational value set to your directional lights.
    An easy way to figure out what value you want to set the SkyRotationPath to is by pressing play in “Selected Viewport” mode, then press SHIFT+F1 to get access to your mouse outside of the viewport. While the game is playing select this BP_TimeOfDay_SkyRotator and navigate the details panel to the SkyRotationPath variable, and then change this value as your sky rotates in your game. You should see the path of your directional change in real time. Once you find the value you are happy with, take note of it, and when you stop playing set this value.
    UpdateSkyRotationSpeed This is the rate at which the sky will update based on the latest data from the TimeOfDay system. The default should be a good balance for most use cases, but if time moves really fast and you want to reduce the skipping you would need to lower this value. To get more performance out of this you could raise this value so it happens less often. Keep in mind your TickSpeed on the BP_TimeOfDay will throttle the updates higher up, and for multiplayer the NotifySpeed variable (also on BP_TimeOfDay) will throttle the updates as well. There is no added bonus at lowering the value of UpdateSkyRotationSpeed below the value of these other variables.
    ChangeSkyOnServer By default this is true, and when true will rotate the sky on the server. If you are using a dedicated server, you can disable this. If you set this to false in Single Player your sky will not rotate.
    FlipSunAndMoon If the auto detection of your sun and moon is backwards you can set this to true to flip the assignment of both directional lights, so your Sun will become the Moon, and your Moon will become the Sun. By default this is false.
    SunPositionAtMidnight This is the offset of your Sun's location at midnight, by default it is set to 90, which is under your level. This is the Y(Pitch) value of the rotation.
    MoonPositionAtMidnight This is the offset of your Moon’s location at midnight, by default it is set to -90, which is directly overhead. This is the Y(Pitch) value of the rotation.
    If the value between SunPositionAtMidnight and MoonPositionAtMidnight is not equal to 180 you will have points of complete darkness during your day and night cycle.

    Most Common Issues

    Timmy I can see my Sun in the sky, but I can’t see my Moon, even though I see light from it.

    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.


    Timmy When I press play it is completely black in the sky but I see light reflecting off things in my 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.


    Timmy There is a period of time where it is completely black and I can’t see anything, but other than this point in time everything else with it is working fine.

    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.


    Timmy I was playing with the settings and then the sky rotator just stopped working.

    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.

    Timmy The sky lighting in my level still does not look right for the time, is there anything else I should look at?

    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.

    This documentation and asset version are new. If you encounter any bugs or if anything doesn't make sense, please let me know.