BP Menu, where to put key events?

Hi all,

I am attempting to make a menu system.

What I have is a menu level and a game level, using a quick UMG UI widget blueprint (Menu). So I have a play button and a quit button, both work, the play opens up the level. I have 2 different gamemodes, MenuGameMode and LevelGameMode, for each level. What I am stuck on is where to put keypress events to toggle the visibility of the menu, at present it stays on the game level and is interactive until I click on the world, at which point the game works but I have a menu displayed I cannot interact with.

Not sure if key events should be in the Menu widget and that stays persistent throughout the game, in the HUD section of the gamemode or somewhere in the Controller class, is there a “proper” way to do this or something obvious I am missing?

The idea I had was that the Menu level would have an overriding Menu system persistent between levels, is this a wrong approach, should I be somehow duplicating the Menu each level?

Cheers

Hello,
As you have set them in your character, the best way will be to use it.

Create an event ( rmb or a keyboard input)
Drag a flip flop
On a : “remove from viewport” of current widget and “add to viewport” of the other one.
Invert variables to add remove on b.
Eventually add a “get player controller” and “show mouse cursor” “enable over events” or any other you may need and set them back on original value.

Actually, I have the menu called in the menulevel level bp.

Now I have figured out how to unload it at level change and realised the menu over the gamelevel was not meant to be there and was unresponsive due to where I had it set up.

The flipflop now works as expected, I now have an event end play that clears the menu for the next loaded level.

I think I will try separate menus for each level, as they will have different gametypes and objectives on each map.

Cheers.