connect the sun (directional light) rotation to a slider in a widget

hay guys.
First of all I’m a NOOB so please be mindful of that fact when choosing the answer difficulty.
I’m trying to connect the sun (directional light) rotation to a slider in a widget, the problem is that i cant directly reference the directional light (sun) actor inside the widget graph where the slider is.

How would i go about referencing an actor inside a widget graph/blueprint so i could move/rotate that actor?

U can make an actor (ASun) containing the light component and the widget component, where in the Tick method u can read the value from the widget component and update your light component

Which blueprint is responsible for creating the widget?

edit: I wouldn’t go the route **Fallonsnest **is suggesting. Slider can use onValueChanged, no reason to get Tick involved in this.

True, this option sounds better :wink:

there is an actor blueprint in the scene that contains the sun and also a couple more objects, this blueprint actor creates the widget

So the sun (directional light) is in the same BP that creates the widget? Or no?

yes it is in the same blueprint

Super easy then.

Create a variable of type *Directional Light Component *in the widget, make it *Instance Editable *and Expose on Spawn. When the BP creates the widget, you’ll see an additional pin on the node named like the variable in the widget. Plug your sun there.

HI any updates for how to move sun with help of slider??



That’s pretty much all you need. Ensure the Sun is Movable.