UMG 4.6 ( My Buttons wont work)

hellloooo :slight_smile:

Okay lets make it simple!

I have a widget and 2 buttons in it, the first button invoke a material to put on a staticmesh, and it work well. But then… the problem is… when i want to invoke the next one, i just can’t!
I have 2 custom event who fire each buttons. Like i said… when i click on the first one it work but the next one don’t. My question is how can i click on the first one (material change) and go to the next (the material change again) and then go back to the first button.

I’m on this problem since 2 weeks now :S
Please help me out!

PS: By the way i have no function that as been made in the blueprint, either in the widget.

This is the StaticMesh that i want to change the material onClicked.

Nobody ?? :frowning:

Sooo… difficult to have a answer for this thread!

Rookie at all this but can’t resist trying to figure stuff out. Maybe the problem lies in creating the same widget over again (WidgetBlueprint_C Widget).

Maybe try taking the nodes you need from the bottom (‘CustomEvent_15’, ‘BindEvent to ButtonClicked2’ and ‘Create Dynamic MaterialInstance’) and incorporate them into your top node tree, and then delete the whole ‘Tick3’ tree?

Thanks Godling for trying to help i appreciate :slight_smile: But yeah… i already tried that, and yes your right about creating the widget over and over again, i know, it’s not make sense. I didn’t figure out how to make it work without creating widget for each buttons.

Are those actual tick events? Maybe just create the widget once on level start?

…and even if I’m not helping in the end… yay for bumps. Hope someone can give you hand.

No, just custom event that i called Tick.

Yeah it will surely help :slight_smile:

Maybe i need to create just the widget in the level blueprint.

I can’t tell completely what you are trying to do (in your BPs) & can barely make out some of the nodes in your last picture at the bottom of your post.
I haven’t converted my UMG HUD Widgets over to 4.6 yet either.
Here’s some examples to show you some options that you might be able to use.

First try not to use event tick unless you just have to, UMG Widget pretty much take care of themselves as far as updating as long as they have Focus.

This is linked straight from an EventBeginPlay node. (not Tick)
anyway, normally I just create the widget in mycharacter BP (or a Player PawnBP), that way if I change levels (or decide to later) the widget goes with it, set an object to the widget (using the widget’s object variable, see detail left) so i’ll have it for later use. add to viewport -> getPlayerController -> pull showMouseCursor (set to true if you need it, and you probably do) after that I set InputModeGameandUI so that the widget has focus (not sure where you need to set this in your case but it needs these things to work
-> at the end you’ll see (in this case) I paused game play (just pull GamePaused node off of pin) because in my case I wanted the Menu to show first and have control and the game play itself to stop.


Then in the Menu Widget BP, after creating the OnClickedEvent for my button, then again in the event graph when button is clicked (I unpause)(not needed unless u paused earlier) but
getPlayerCharacter (node then pull off blue pin) cast to MyCharacter then (pull off of it’s blue pin) & get your Widget Object you created in PlayerBP (MyCharacter or PlayerPawn BP, whatever you called it)
This will give you control over the widget where you can add or remove it - set visibility, whatever (this might have changed in 4.6 to remove/add child. haven’t got there yet)(so just try it out)(if not look it up)

I know all that sounds complicated but not super hard to figure out once you run thru it, most of this will show up in context menu
But looks like from there you should be able to:
**Select your cube object in your editor , yes, in the main viewport or on the right in the scene outliner, then just right click in your Widget and reference the cube as an object (should be at top of context menu)(not super sure about this step but should work, if not you should be able to create an object as a variable, if it’s a BP object)
*** once you have something to pull from in your widget , pull out and set your material from there, I don’t think you need to do anything in your Cube BP


Hope this clears up and doesn’t confuse you, basically I’m saying to use your Character BP to create your widget & set a widget object
then in the widget BP, create the onClicked event for the button , then in your event graph use that event to change the material on your Cube object (create the cube object in the widget)
then at some point you need to set focus to your widget(SetInputModeGameandUI, for example) and then show your mouse so you can click those buttons, then you need another ‘key’ etc event to remove the widget (might be RemoveFromParent or something now, in 4.6 not sure)(in 4.5 was RemoveFromViewport) so regular gameplay can continue

And I am no expert, but wanted to try to give you some things to try out and get yourself going again. most of this can be found in the documentation or by using google.
also remember this was done in 4.5.1 , in 4.6 I know they changed set visibility but haven’t looked to see what else they changed in UMG (Widgets)

Thank you very much ayretek!! I will see if i can do something with this :slight_smile: Thanks!!!

good luck, and sorry I know it looks like a mess, but I hope it sends you on the right track.

Thanks!!! Yeah i think we got something here! Gotta go to sleep for now, i will see this tomorrow! Thanks again Ayretek!! :slight_smile: Il keep you post!