Download

UMG-toggle widget menu

Hi everyone.
I’m trying to make a menu who is toggled with a keyboard touch.
I saw some tutos on the web but I can’t find the right way to do that.
I created a bp_game mode, a bp_hud within a bp_widget with 2 buttons: “Resume” and “Quit”. Exactly like in the HUD Example from the market place.
How to toggle it with the keyboard?

I’m sure there’s a way to do that but I can’t find anything…
Can you help me?
Thanks…

Create a second widget and set his design
then add on first widget a button where you call the other one. ( remove self (usual widget) from viewport and add second one to viewport in binded event function )
and do the same but inverted on the second one to come back.

Exactly the same than show first widget and resume but dedicated to differents targets.

Hi Fen,
Sorry, I don’t understand… (but maybe my english level is to poor…)

Here is a screenshot of what I did. I can launch my “Menu1” by pressing the "L’ touch, but I can’t hidden it by pressing the same “L” key.
There isn’t a node (or anything way) that would allow this?

HUD_testMenu.jpg

My bad, not yours.
First follow this umg setting https://forums.unrealengine.com/showthread.php?35085-UMG-Tutorials-(-Introduction-and-data-binding-) (the menu link. do it step by step and you’ll have a 2 buttons set with binding events used on buttons. Don’t forget to activate umg in “editor preferences / experimental”
Then add another button where you’ll add in bind event : e4d81c684c18b82be3096aa025fbd2b2cd333197.png
Create the second widget and bind the back to menu button like this one but with an inversion of widgets.

Thanks Fen,
I saw this tutorial 1h ago.
I just did it, but I have two problems…

  • On the primary setup (the Menu Widget), I can’t hide my menu cause “Modal” checked. I don’t know why…
  • I can’t find the “Cast to [hud]” node. I don’t know why…

I just keep searching!

About primary set up, does your hud looks like this : HudOptions.png
meaning that you have to create widget and variable for each widget but add to viewport only the main on tab event. And remove it on others but add new one.

The upon “begin play” widget is not in the same use so don’t take care about it.

to find "cast to " never use exe wire but value wire (the not white one ^^)

Everything is working fine!
Thank you Fen.
I still have an issue with the checkbox “Modal”, but let’s go step by step!

Thanks a lot Fen for the example, i was searching for 2 days how to make my menu disappear with the same key it appeared !
I was missing the “isValid” node and some logic in my BP :slight_smile: