Download

Setting an actor properties with UMG

Hi.

I am trying to change the “hidden” property of an actor in game by pressing a button in the UI. I am using UMG, but i can’t find a way to get the reference to that actor in the Event Graph in order to use the “Set Actor Hidden in Game” node.
The only way that I have found to get the actor’s reference until now is to make a class with this actor and then use a “Get all Actors of Class” node to retrieve all possible references of this class in the map into a matrix an then extract the element at index 0. It seems a quite weird approach of doing what should be a very simple task. Moreover, it worked but stopped working after I reorganized the assets a bit in folders.(¿?)

So, please, can someone give me a clue of how to retrieve the reference of an actor in the level from an UMG UI Event Graph?

Thanks in advance.

 Luis

The options you have all depends on what the object is used for. If it’s something the player can click on to select, could could store the actor in the player controller when they click it. This can easily be accessed from UMG widgets by getting the owning player controller and casting to your custom player controller class.

Thanks for your reply. Unfortunately, this is not the case. I am looking for a method to change properties on actors based on actions in the UI, for instance, change the color of a carpet selecting it from a catalogue of colored buttons in the UI, selecting different illuminations of a room by switching on and off groups of lights with a button or changing the model of chairs by hiding/unhiding actors selecting the option from the UI…

I am surprised that, being so easy to access actor components in the player controller it is so difficult to access actors on the map.

Still looking for ideas. Many thanks.