[UMG] Button disabled state

I have been experimenting with UMG in 4.4 and the 4.5 preview. Everything has been going well so far except for one small feature. In a weapons HUD I am creating, when a weapon is selected I want it to keep the button’s “pressed” image until a new weapon is selected. So far the easiest way I can think to do this is disable the button when it is pressed and set the button’s style so that the ‘disabled’ image is the same as the ‘pressed’ image. However, when I disable the button it simply greys out and does not show the image I set in the widget style. Is this a bug or does the disabled field in the button widget style not correspond to the ‘Is Enabled’ boolean in the Widget?

Hi ,

Can you post a screenshot of how you are setting up your widget, calling it, and attempting to disable the button? Thank you!

Hi ,

I’ve attached screenshots of the widget’s setup, the onClick event and the creation of the widget in the level blueprint. I have also attached a screenshot of the button before it is pressed and after when it is disabled and not showing the disabled colour I set in the widget.

These are from a fresh 4.5 preview project where the widget is spawned when the game starts and all the button does is disable itself.

Thanks,

The on clicked event is bound to the click event for the button so it gets called when the button is pressed.

The OnClicked event, where are you calling that? Is it in the widget, playercontroller, etc?

What I mean is where are you calling the event? For instance, is the Event on clicked node in your image specifically in your widget blueprint or is it located in another event graph? I realize that it is a bound event, however knowing exactly where you are calling specific events will help me to reproduce this on my end.

Oh I see what you mean. The OnClicked event is inside the widget blueprint’s event graph and the BeginPlay event is inside the level blueprint.

Hi ,

Is this still occurring with the full 4.5 update? Please check and let me know, if so we can continue to try and find out what is going on. Thank you!

Hi ,

I’m just downloading 4.5 now, I’ll be sure to check if this still happens once the download finishes and let you know.

I have replicated this in the new 4.5 update and the problem still seems to be there. I have attached screenshots below from the new 4.5 project I have been testing in.

As before the OnClicked event is located inside the widget blueprint and is fired when the button is pressed. The widget is created in the level blueprint using the BeginPlay event. Let me know if you need any additional information.

Thanks!

The Widget layout:

The event graph for the widget:

The level blueprint:

The widget before it has been pressed:

The widget after it has been pressed and disabled:

Hi ,

Try following the hotbar button example here: https://docs.unrealengine.com/latest/INT/Engine/UMG/QuickStart/5/index.html. If you set up a bool value after disabling the input, you should be able to save the disabled image until you alter it through another function.

Hi ,

I’ll give that a try. I’ve been exploring UMG in 4.5 more and it also looks like if that doesn’t work I should be able to get something working now that I can dynamically change a widget’s style through blueprint.

Thanks for your help!