Deactivate Player Controller while displaying menu?

Hello and good day!

I have an annoying little problem, and I believe there’s a really easy way to fix it. I’ve created a very simple main menu with UMG containing two buttons: Start Game and Quit Game. Looks like this:

main menu itself is its own level, and Start Game button loads game’s first real level, while Quit Game button simply quits game. Looks like this in blueprint graph:

Inside Level Blueprint, it looks like this:

Now, both of these buttons function correctly. problem is:

  1. When playing in editor, if I click outside of buttons it activates Player Controller, which means it’s suddenly possible to move around in level while menu exists - and when this happens it’s not possible to get back to menu to click buttons.

  2. When playing as a standalone game, menu is visible, but not functioning. Which means I can walk around in level, but not click menu buttons.

Therefore, guess I need to know how to deactivate Player Controller as long as menu is visible.


You can set input mode to be game only, UI only, or both. Check out section, Set Input Mode and Show Cursor in documentation here:

Hope that helps!

Is there a way to do this without setting input to UI only?

If I set input mode to UI only, whatever key I was holding down stays held down (i.e. if I was walking, I continue walking).

You could add a bool variable something like bCanPlayerMove and set it to false in beginplay in main menu level and in your main level set it to true. Then you can just branch in your character bp and only allow movement if its true (assuming you’ve got your main menu as a separate level like initial post).

You can do this by setting to Game and UI. It turns it into something like World of Warcraft style controls if you set it up right.

thing i did is just to do that every tick it sets mouse to on screen.
but i guess that’s not best way to do it.