I would like to change the sun angle in a widget interface, like you input the angle in the widget and changes apply. I have tried to use event graph in widget blueprint editor and casting to skysphere to access sun position variable but it was not working. Any idea how to do it though.
sorry for using wrong word. I should have said using sun position. Could you tell me the mistake I made? Here are my nodes.
Use a GetActorOfClass node to get the sky sphere reference.
Why not go crazy:
Dispatch any data that you need to the Level Blueprint. Since the LB can make direct refs to the actors you can do anything with any entity without ever touching Get All…
It looks ok to me, but I don’t use that sun position thing. Anyway, that’s one way to do it.
Personally, I’d probably go via the game instance, just to avoid the level BP. But that’s more typing… Maybe Epic should do something about this. Is there actually a nice way to do it?..
You already have the sun reference, and you’re passing it the angle. You can just show that angle in the widget as a text box
Is it feasible to show the value of sun rotation in the ui as you slide through? Should I use get actor of class to access directionallight blueprint in binding function of editable text?
Ensure you flag the text block as variable at the top of its Details panel. The rest stays the same.
Btw, we’re using Light Source rather than Sky Sphere for the following reason:
Your mileage may vary if the lights are set up differently. This is based off the blank template.
Should I use get actor of class to
access directionallight blueprint in
binding function of editable text?
Avoid it like the plague. Bound functions execute every frame and if you read that node’s tooltip, it will warn you not to use it in such way.
Get All / Actor of Class / Tag nodes can be great but they are often abused - blame tutorials that take shortcuts, promoting bad scripting rather than showing how communication is supposed to flow.
To clarify - if you ever only have 1 light, it’d be absolutely fine to obtain the reference during widget’s EventOnInitialised with Get Actor of Class. Problems start when you have 2 lights and things get even more interesting when there’s 20 of something you need to get to.
I just have beef with the Get All nodes, that’s all. They should have a red pulsating frame around it and ask you to fill a captcha and perform a ritual before you can plop one down…