Issues with Pause menu, resume button and incorrect flow of code?

I’m trying to get some experience on basic UI and I’m struggling with a small error that I can’t seem to fix.

Essentially I have this small blueprint which is located on my Third Person Character


whenever I press Tab, the pause menu should show/close based on the multigate’s index, this works with no issues whatsoever

By pressing resume, the menu should also close which it does

but, by pressing resume the index of the multigate will not advance
meaning that the next time I want to open the menu, I will need to press Tab 2 times so that it would open.

I tried fixing this by creating a shared boolean on my HUD that would turn on if I pressed resume and trigger a multigate cycle based the current state of the boolean so that the Index would corrected the next I wanna open the menu again, however I cannot get his to work at all.

Is there an easier way to fix this?

It’s the same problem with flipflop nodes :slight_smile:

You also have a problem, because you have the same functionality in two places.

Don’t use the gate ( or flipflop ), use a branch, and inspect the widget reference. If it’s valid, you need to kill it, otherwise you need to make it. Put in a variable, rather than taking it directly from the create node.

I tried producing what you’ve explained here but I’m not really picturing it, can you elaborate a bit more?

Core functionality is

( with the mouse code etc, of course ). Point is, use the variable to know if you need to open the widget or not.

Like this?

I kind of see where you’re coming from now, Is Valid should check if the menu is currently active on the player’s viewport based on it’s actual state rather than a sequence like flip-flop. It’s working, kind of, the menu will open and close, however it stops working after it closes. Which is weird since an Is Valid check should always trigger if I press tab.

Hey there @sQuAdeRee! You can also clear the menu var when removing it as well. I’d do this for 2 reasons, one there’s still a reference there (however it’s been put in the pile to be garbage collected and I’m not sure if it’s still listed as valid while waiting to be collected). Two after you remove it from it’s parent it gets flagged to be garbage collected, but won’t be collected for between 1 - 10 seconds.

You need to clear it when you remove the widget

image

It’s working now.



I still don’t exactly understand the logic behind a few things here but it’s working for now.

1 Like

I don’t think you need this bit