Creating a simple day/night cycle in C++

Hey there,

can anyone point me to how to create a basic day/night cycles in UE4 using C++? I am using the default Sky Sphere BP with a Directional Light connected to it. Know what do I need to change to achieve a different day/night time? Do I just need to get a code reference to my Directional Light and then make it rotate using the Delta Time?
I read somewhere that changing the daytime is as simple as tweaking some values of you Sky Sphere / Directional light but I don’t really know which values to change. If I rotate my Directional Light in the inspector it seems to only change the angle from which the light comes but neither the brightness nor the color of my SkySphere (even though I “inserted” the directional light in it as “Directonal Light Actor” which should determine sky color etc, as far as I understood it.).

I can only find Tutorials on how to create this using BPs but I really want to know how it’s done using C++.

Edit: Okay, it seems that I need to click “Refresh Material” in the SkySphere Blueprint, once I have rotated my Directional Light. But somehow I can’t check the Box and have to click it manually everytime I actually rotated the Directional Light. Is there a way to rotate the light and refresh the material afterwards in C++? Because I have no idea how to get a reference to the SkySphere BPs “Refresh Material” in C++.

get reference to light and addlocalrotation or addworldrotation to the light in tick for rotating the light.

Make the sphere in the c++ class and attach it in its constructor. At begin play make a dynamic material using createandsetmaterial instance from the sphere. (or material parameter collection). They change all the parameter as needed!