change button image at runtime (blueprint)

Hi,

I have a widget blueprint that I want to use in my HUD. It is basically a ‘Button’ that has a child of type ‘Image’.
When I click the button (there are several in my HUD), I want it to have a ‘button selected’ look by changing the image into something else. The button will remain ‘selected’ until another one is clicked.

I feel like a complete idiot, but I just cannot get this to work … Hopefully one of you can help me …
I have already tried many tutorials, but it seems like I’m always missing something important.
I think I’m supposed to use a material instance with a parameter, or maybe a dynamic material, … ???

Hi,

go into your Widget, open the Event Graph and do this:

Capture is the “Get Image”. Change the values of the open inputs. If you want to change the image then just use Set Brush from texture.

Cheers

2 Likes

How can it be this simple ??? I can’t believe I wasted a week trying to figure this out …
Thank you very much !

Some super advanced way to change button image that is now possible with the power of Unreal Engine:

1 Like

This answer is certainly better!

Thank you, that was a great solution!

1 Like

I simply did it this way… On the first Make State Brush in “Image” is the image called “Widget.png”, and on the other Make State Brush in “Image” is the image called “WidgetBarra.png”. All handled with the Filp/Flop node, of course. The button in question is called “HiddenWidget” and is used to hide or display the entire widget. Or rather, all the other buttons and components of the widget itself.