Video Demonstration ---> https://youtu.be/qeB6LtvdQyE
You can use the functions in this project in your game in order to achieve a real-time time of day system in the vein of games like Animal Crossing, Pokémon, and Cozy Grove.
This system is not simply a linear day-to-night transition. Rather, it uses the time of sunrise and sunset based on real world data and smoothly interpolates between them. The time of year is taken into account as well so that there is daylight for longer during the Summer than during the Winter for example. This is also interpolated smoothly and naturally.
The two things that you will need is the Animation Curve, ac_timeOfDay, and the function, TimeOfDay, which is found in the script file, scr_timeOfDay.
ac_timeOfDay contains curves that tell the system the position of the sun at sunset and sunrise throughout the course of a year. This allows the sun to be out for longer in the Summer than it is in the Winter. These curves are able to be customized to your liking.
timeOfDay takes a datetime as an input, and outputs an array of useful values that can be used in a variety of ways such as controlling the ambient light colour and blending multiple sky textures or surfaces.
Included is a demo project that shows how this system could be used with features such as real-time ambient light colour, sky texture blending, and 3D light direction.
Requires at least IDE v2023.4.0.84