Pressing a Button fires off menu anywhere

Hello,

I have the ‘Gamepad Special Right’ button mapped to open the ‘Pause Menu’ in my game.

However when I’m in the ‘Main Menu’, which is in a separate level, the ‘Pause Menu’ still opens when pressing the ‘Gamepad Special Right’ button.

How do I make it so that the ‘Pause Menu’ is only opened when I’m in the game level and not any other level?

Thank You Kindly.

(the Blueprint script making up the ‘Pause Menu’ is below)

You need to create a boolean called IsInGameLevel, and set it to false when press the button that opens the main menu. Then set it to true when you press the button to go back into the game.

You now need to use a Branch node to check the IsInGameLevel boolean when you press the button for Pause. Don’t fire Pause when you are not in the Game Level, and IsInGameLevel is set to false.

The ‘Main Menu’ is opened when the game starts. I’ve added an IsInGameLevel boolean (to false) there from the sequence node that is already present.

The ‘Play’ button opens the game level, I’ve set that IsInGameLevel to true.

In my ThirdPersonPC, I have added a branch node, then off False, I have set an IsInGameLevel as false.

The ‘Pause Menu’ still shows up though when I press the ‘Gamepad Special Right’ button.

(I’ve attached the changes I’ve made based on your suggestions)

][1]

284676-pauseev02.png

If you look at this picture, you will see that the Branch off of InputAction Pause will ALWAYS return true, as you have ticked it.You need to get IsInGameLevel, and plug it into the branch node. That way it will know whether to fire or not.

You should also delete the Set IsInGameLevel from where it is now in the Pause flow. You will only be setting it to false, if it is already false. :slight_smile:

Simply do a branch that will check if the game level name meets the name you need (e.g. Get Level Name → == MyLevel) if it is true then the pause menu will appear