UMG - How do I get a slider to move an actor?

I’m trying to get a UMG slider to move an actor in my level. I’ve built the UMG components and they show up just fine. I’ve got the event setup for moving the actor. How do I link the actor to the UMG Widget?

Well, I’ve got this working by using ‘Get All Actors of Class’ which, whilst it works, is not ideal in my mind. This is what I have in my slider event;

But really I’d like to specify the specific actor object that the slider should change rather than iterating over all possible actors. In my head the way it should work is I add a variable of the Actor Class to my widget which is exposed publicly and then I can just set that to the specific actor in me level. But it looks like those variables aren’t exposed in the details panel to let me do that. I’m trying to make a ‘kit of parts’ so that non-blueprint users can use these in their levels without any issues. Any suggestions welcome.

Your desire is correct, but the finer details are a bit off. Widgets aren’t actors so they can’t be placed in the world as level elements, they’ve got to be created dynamically, so they won’t be able to be bound to actor references in a particular level like that. When your UI is constructed, you should assign the variable to the live instance of the actor you care about. Though what creates your UI is probably also another dynamic actor like a player controller, who also has no knowledge of a specific sun actor.

Your best bet might be to find the sun actor in the Construct event of the widget and store it. Then you only need to do the search once.

Thanks, that makes some kind of sense. I like the suggestion of setting a variable in the construct event - I’ll definitely re-work the blueprint to do that. It might not be completely the way I’d like to do it but it’s definitely more efficient than what I have now. Thanks.