Main Menu in the same level as game

I want to have a main menu in the same level as the character, instead of having it in a whole new level. Having the player input disable, only moving in the menu. When “start game” is pressed on, a matinee will play then I will take control of my character and play the level.

My menu widget

1 Like

Hi,

For first part you need to do something like in the image 1 in the desired level so on EventBeginPlay it will add the MainMenu to viewport using the Set Input Mode UIOnly wich target is your players controller and the Widget to focus the same that you Create using Create Widget then you just add to viewport. For the second part lets assume you have A Play Button add something like image 2 to its click event.

Hope this helps.

Excuse my english.

Regards.

Hi, does it works for you? If so please mark as answered so it gets closed, if not you are free to keep asking.

Regards.

I’m sorry for the delay, but I haven’t received an E-mail until now. I don’t understand the second picture. Which blueprint are you putting those nodes in? This is how I have my widget blueprint setup, for my menu.

The bottom of that is for using a controller for moving through the menu.

Hi, nodes in the second picture are within Main_Menu widget Eventgraph.

The key in there, regardless of how you manage to Create/Remove widgets, are the “Set Input Mode UI Only” and “Set Input Mode Game Only” so player while in UIOnly will only able to use menu and when in Game Only able to play normally.

Regards.

I don’t know why, but I can’t control my menu. I’ve set up the level blueprint exactly as your screenshot and here’s my widget blueprint.

Ok, i think you are not handling the keypress correctly,

As you need to trap the keypress within a widget it works different, you need to override the OnKeyDown event, to do that select the On Key Down option in the Override drop down next to Functions as in this capture:

75468-1.jpg

You will get a new function set your nodes as this:

Note: You will need to handle your rutine/logic in there I only set the if you press G the main menu will close and give control to layer over level. You can remove the Print String after debug it is just to make you notice that the Key was detected when pressed.

Regards.

Thank you so much for helping!

In this scenario, where would you put the matinee script? After the ‘add viewport’ node in the level blueprint?

How does the level know to wait until a button is pressed in the main_menu widget beforing continuing to the matinee?

In that scenario, I would like to think that you would need to add a boolean. I’m just spitballing here. But add one in the level blueprint

Then add one in the menu widget blueprint

Make sure they’re both visible, have the eye open on the left panel showing all the variables. so when you’re on the menu, you press continue or new game, then the matinee would play. I haven’t tested this yet, but I hope this puts you in the right direction