Download

Blueprint on Object to command Widget UI

Hey everyone,

I have a working blueprint that swaps materials on the floor whenever I left-click and I want to connect this to the HUD where a border will appear around the corresponding thumbnail. I know about custom events but I`m having trouble wrapping my head around how to get this working. Any input would be great!

Anybody? Here is a video for better explanation. Id like for a border within the widget to highlight the corresponding material that is applied to the floor.

[video]https://youtu.be/l8cdfdxK_rE[/video]

First create a custom event in your Widget Blueprint, call it ‘Colour Changed’ or somthing, give it an Input variable as an Integer. Then in the blueprint you have shown in the attached image, after each of the set material nodes you have shown, you need to cast to your widget blueprint, get a reference of it somehow (Get all widgets of Class would work), then after the cast node, Look for the ‘Colour Changed’ event, it should let you set the integer value straight away in the node, (use something like 1 for white, 2 for brown, 3 for black).

Now back in your widget blueprint hook up the event node to some logic to check the integer number and fire off event. After I typed this another way would be using ENUMs, but this is faster to setup as what you want is pretty simple.

If u need me to make an example graph screenshot let me know

Appreciate the help! Here is what my graphs look like now… I am getting an error in my floor blueprint. Here it is…

The bottom is the Widget blueprint. If you could show a screenshot of both graphs that would be awesome!

EDIT: Also attached a screenshot of the widget itself. I have 3 border elements that are all set as disabled as default. As the materials on the floor are swapped, I want the corresponding border to be enabled and then turned off again when one of the other two is selected.

A little tinkering around and I got rid of the compile errors in my floor blueprint. Now I could use some hints on how to set up my widget blueprint to set the visibility of the 3 border elements.