Problem with pausing/ unpausing game

Hello community, got a little problem here. I want to pause my game by pressing Esc- key and also showing a widget (Pause Menu). By pressing Esc again, the widget should disappear and the game should continue. This works for the first time, however it doesn’t work afterwards. So when I press Esc the game pauses and the widget is shown and when I press Esc again the game continues and the widget disappears, but when I press Esc again nothing happens and I don’t know why. Here is my blueprint code:

you’d have to set the pause menu variable to a null value when you unpause the game. A null value is just a ‘set’ node without anything being set.

right now the variable going to be valid after the first press onward.

or you can use a flipflop node.

And where do I connect the ‘set’ node to? I mean where to place the node?
flipflop node would work, but I have to check whether the widget is shown or not and I can achieve that with a isValid node.

Hello,

I can achieve that with a isValid node.

Actually you can’t, because your widget reference will still be valid since “Remove from Parent” doesn’t destroy the widget ref. It stays in memory, so your “is valid” will always return Valid since you spawned your widget once.

To fix this, you can just Set your Widget Reference right after “Remove from parent” and set it to none (just leave it empty), now your reference will be “invalid”.

that really fixed it, thanks!

You were able to fix it? I’m having issues with the pause game too. It’s causing my widget for my sprint button to permanently pause the regeneration which is a huge issue for my system. Even not pausing the game and doing focus on widgets does a similar effect to this. Do you have a picture of the fix you have for this? I don’t understand what the other person means by set “null”.