x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

[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?

Product Version: Not Selected
Tags:
more ▼

asked Oct 09 '14 at 06:35 PM in Blueprint Scripting

avatar image

slee1990
73 6 13 17

avatar image Adam Davis STAFF Oct 09 '14 at 08:24 PM

Hi slee1990,

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

avatar image slee1990 Oct 09 '14 at 09:00 PM

Hi Adam,

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.

alt text alt text alt text alt text Thanks, slee1990

avatar image Adam Davis STAFF Oct 09 '14 at 09:16 PM

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

avatar image slee1990 Oct 09 '14 at 09:17 PM

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

avatar image Adam Davis STAFF Oct 09 '14 at 09:37 PM

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.

avatar image slee1990 Oct 09 '14 at 09:42 PM

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.

avatar image Adam Davis STAFF Oct 14 '14 at 06:15 PM

Hi slee1990,

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!

avatar image slee1990 Oct 14 '14 at 07:54 PM

Hi Adam,

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.

avatar image slee1990 Oct 14 '14 at 09:28 PM

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: alt text The event graph for the widget: alt text The level blueprint: alt text The widget before it has been pressed: alt text The widget after it has been pressed and disabled: alt text

avatar image Adam Davis STAFF Oct 15 '14 at 05:00 PM

Hi slee1990,

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi Adam,

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!

more ▼

answered Oct 15 '14 at 05:49 PM

avatar image

slee1990
73 6 13 17

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question