Update Sun Direction Error

I get errors when I call the Update Sin Direction Method from the SkySphere:

Blueprint Runtime Error: Accessed None trying to read property Directional light actor from function: ‘UpdateSunDirection’ from node: Set Vector Parameter Value in graph: UpdateSunDirection in object: BP_Sky_Sphere with description: Accessed None trying to read property Directional light actor

Blueprint Runtime Error: Accessed None from function: ‘UpdateSunDirection’ from node: Set Vector Parameter Value in graph: UpdateSunDirection in object: BP_Sky_Sphere with description: Accessed None

Blueprint Runtime Error: Accessed None trying to read property Directional light actor from function: ‘UpdateSunDirection’ from node: Set Sun height in graph: UpdateSunDirection in object: BP_Sky_Sphere with description: Accessed None trying to read property Directional light actor

Please help, I am trying to make a Day/Night cycle

Assuming you are using one of the standard templates with a BP_Sky_Sphere, the proper way to create a day/night cycle is:

  1. change the Pitch (Y) rotation of the Light Source representing the sun to set the proper time of the day/night. The classical way is to add a bit of pitch at every Tick, but you can also use a timer or some other method. If you use the Event Tick method, remember to multiply the base pitch variation by World Delta Time to take into account variations in the frame rate
  2. once the pitch for the sun Light Source has been modified, invoke Update Sun Direction for the Sky Sphere so the sky representation is updated according to the height of the sun

Make sure you make the Light Source representing the sun Movable so its rotation can be modified via Blueprint

1 Like

Yes, a very late answer from the future : I got same issue. Solution : in your sky sphere, at directionnal Light Actor you have to select your directional light.

6 Likes

“Accessed None trying to read property Directional light actor”
Or “hey did you forget to tell the sky sphere what light it’s supposed to use as the base for positioning the sun disc?”

Also while on the subject. DO NOT modify the sky sphere. Create a copy (a hard copy) or instance a child to make modifications, so that the rest of your projects won’t be affected.

and
You have to manually loop the sun around back to 0 after 360deg because of gymbal locking.
Tick * sun speed = SunAngle - if sun angle >360 sun angle 0.

how to select it?