Texture 2D object reference is not applied to the Set Brush function

Hi all,

I have a class called CommonMapButton which inherits from UCommonButtonBase (Common UI Plugin). I generate multiple Map Buttons and for each element I assign a UTexture2D to the property MapImage. I then take that property and want to use the texture for the Brush in an Image (UMG). However, despite the property having the correct object loaded (as you can see in the screenshot) the Image is not updated. Maybe I’m supposed to use another function or method. I have tried to use SetBrushFromTexture, however similarly it did not update the Image.

Any help on this would be appreciated.

try to use the “SetBrushFromTexture” Node :smiley:

Hey Patrick, as stated in my initial post, that unfortunately did not work either. I can confirm the event is fired and the property has the correct texture assigned.

I tried an approach where I would make a Dynamic Material Instance and use that for the brush, but that didn’t seem to work either.

Ah… completely oversaw the CommonButtonBase ^^

Unfortunately… the Common Style Objects are EditDefaultsOnly and BlueprintReadOnly… so… no chance to set them via Blueprint…

What you can do is to completely get rid of the Common Style Button… and write your own (done myself so)
My current Button (inherited from CommonUIButtonbase, that inherits from CommonButtonBase) is this:
Unbenannt

So… State is Normal, Hover, Pressed and Disabled…
And i simply switch them on hover, onClick and when i want to set this as disabled…

My OnClick is just this function:

  • The default Confirm Method of the CommonUI Input.

To forward the click, hover state, pressed…etc to Widgets containing that button… i added Event Dispatchers and simply call them via my interface functions…

changing Button image… ist just a SetbrushFromTexture for the Image Widget inside it ^^

As you can see… i use an Interface, that i added to my CommonButtonBase Widget… including some functions:
Unbenannt3

So my CommonButtonBase simply looks like this:


It calls the Interface functions on itself…

And in my Button Widget i implement the Events to that functions, to trigger the style changes and call the Dispatchers:

I know… not the best solution… but helps out alot… and gives me more freedom in designing that stuff…
And to make sure, the Button Style is not used… just make it Drawing as None…: