Download

Pause Menu Script Not Functioning?

Hello,
I have a pretty basic non-functioning pause-menu script?
Can anyone spot the error?

Basically, upon pressing ‘P’, the menu opens but when I press P again, the menu does not close nor does the game unpause.

Please view the attached image :slight_smile:

Thanks

Your input events are not triggered when paused. To fix this simply just set the input actions to be executed when paused.

eb46acd89829c1acd3da0362ba676261c02592bd.png

Hey,
Sorry about the long response, I was away.
However, my P Input currently is Execute When Paused (Checked).
Do you see anythign else that could cause this issue to occur?

To test this, i also tried remove widgets and it removed all of my widgets; however, I’m only trying to remove the pause menu, not all of them.

Bump – the error still persists

What’s the p key trigger? That’d help to see if we are talking what is doing is not expected.

Sounds like the remove from parent is calling more then just the pause menu or you are calling remove all widgets.

What are you asking? And nothing happens everything just stays on the screen. It’s as if it doesn’t run when it’s paused when it should.
So i don’t think i’m removing everything.

The only way to remove individual widgets is to hide them. This seems stupid, but I had to keep all my widgets “attached” to the viewport and then hide the menus I don’t use. I’m certain there’s some overhead involved with this, but until we get the option to close individual widgets, this is the only way to have a pause menu disappear by itself. Perhaps it would be better to have some post-closure construction scripts to reopen HUD elements following a complete menu closure.

So, Set Visibility is the node you’re looking for. Hidden is the best choice.

The widget is not being removed most likely because you’re never setting the variable that holds the reference to the widget (where are you setting “Pause Menu Ref”?). Unless you have some nodes you’re not showing you’re trying to remove an empty reference.

As far as the game not being unpaused, I can only guess it’s because either the P key is not being set to Execute When Paused like Azarus said or because you have P bound to something else somewhere on your blueprints that’s consuming the input. I replicated your setup and this works like it’s supposed to, so yours should work too.

0c41c379af318c0316c670e7c15ddb89287c4306.jpeg

How do i set the value of a widget reference to my widget?
Pause menu ref’s value is currently null; however, when i try to search for my widget it wont appear nor can i drag it in.

Drag the variable you want to set (pause menu ref) and select Set.
Then drag from the blue dot (Return Value) on the create widget node to the setter node.

If your reference variable is not right not some reason you can drag out from the create widget return node and release the mouse button over empty space and select “promote to variable” from the menu.

Ok so i got this so far. How can i assign the “Set Pause Menu” node’s asset to a widget in my content browser?

666ada654f14dbe77193ad805569e1a113b98361.png