How to access the "default sun" from code?

I am very new to UE and this might be a very “noob”-question.

However I am wondering how can I access and manipulate the “DirectionalLight”-actor in the World Outliner by using C++ code?

I saw a tutorial on how to make a day-cycle with Blueprint, but I need to do this by using code, and I’m not sure where to start. I’ve figured out that I at least have to start by doing “stuff” with the sun, which is why I want to know how I can access it from code.

you can do it the same way that sky sphere does - link it as property in some “day-night manager actor”.

you can get it by using GetAllActorsOfClass function.

you can even create it as new object in your “day-night manager”.