Pause menu doubt

Hello everyone.
Ive followed several tutorials but I havent figured out yet how to solve this.

I have my project, when I start it, it shows a MainMenu. I press Play and game starts.
Then inside the game, I press P for pause, and it brings MainMenu back. Here comes the trouble :
-If I hit Play, it returns to game. BUT if I press P again, it creates another MainMenu widget disabling me to exit the menu. How can I prevent this?

I know I can make a flipflop for every time I press P MainMenu appears and disappears but I want to force the user to hit the Resume button instead of pressing the keyboard.
Maybe a node for disabling the keyboard?

This is my blueprint, its made inside my character BP as you can see, its nothing fancy :

Thanks in advance!

Very simple logic, just add a Boolean, and set it to true when you add the pause menu, and false when you remove it, only allow the player to pause if the variable is false.

Please, could you put a image example? Do I need a Branch node?

Yes, right after the input, there should be branch, and the condition should be the Boolean variable, on the true execution of the branch it should go to the Set Game Paused.

Ok, something like this?

I just created the boolean variable with no options or functions. Do I need something else? Thanks again

You need to hook up Pauseboo to the branch. That branch is always true.

Ok, did that but now the Menu doesnt appear when I press P

Anything missing?

You need to set Pauseboo to FALSE, and then set it to TRUE wherever you remove the menu

Fine, I think it works this way. Even if I press P again inside the pause menu it doesnt bring over another widget. But a new problem has appeared, the second time I press P it doesnt bring MainMenu back anymore. Nothing happens. So the whole thing only works 1 time.

*Edit, still doesn’t work. P key always brings widget. So if I start the game and press P it makes another widget all the time. I’m totally stuck.

Like I said, you need to set Pauseboolean to false when you remove from parent.

Sorry but I dont get it. Set it to false from the branch? Put another Set Pauseboolean node linked from True? Uncheck the Pauseboolean tick? It would help a lot to put a image with the process… :confused:

Keep everything the same as in that picture above, but after you do Remove from Parent, set Pauseboolean to false.

Ok, did that. Still doesn’t work fine.

Issues :

  • In the MainMenu if I press P, another MainMenu appears over the first one and I cant quit it anymore.

  • If I press Start, and then pause the game, it works. BUT after 2 times it stops working. Besides, I need to press P twice in order to make MainMenu to appear.

I think I desist. Its not possible to be this hard! Every change I make it gets worse…

Ok, send me a pic of your BP. You need to set Pauseboolean to false anytime you remove it with Remove from Parent, and set it to true anytime you spawn it. With that said, since you don’t want them to be able to use the keyboard to remove it, just use the same code for the False of the branch wherever you remove it.

Thank you for your time. Let’s see

I included the whole BP. To the right I put all those nodes which allow the cursor to not press twice onscreen for selecting the buttons.

This should work as sort of a flip flop that can be used in many places, anytime you either want to spawn or remove the menu, just use the whole blueprint that you have above. This should currently be working if you keep pressing the Pause input.

It doesn’t really work. It keeps duplicating the widget if I press the Pause input while I’m inside the MainMenu. Besides I need to press “P” twice the second time I want to go to the Pause Menu. Doesnt make any sense.
I think the only way would be disabling the keyboard inside.

I’ll try another method. :frowning: