Download

Main menu

I’ve created a main menu for a 2D game I’m making but a problem I’ve noticed is that the player can still move the character around if they click anywhere but the buttons. Is there a way to fix this?
128af6fda950c8daef538e4675f7128691edb3a3.jpeg

d10a650b297e75a30943ae1944fe61c1c228a708.png
I think set inputmodeUIonly will do the trick

I can’t get the self node and target to connect. Here’s what I have so far.

Target ->Get Player Controller
In Widget Focus-> Self

The character still moves if you click anywhere but the buttons.

Where do you create this widget? That’s probably where you want the set focus to be. Right now it only gets focus after you’ve pushed that button and removed it from the viewport

I created this widget within the 2D game blueprints. When you press play it appears on the main viewport.

dab0011411591614ab861a3870cba6b2813416a2.jpeg

Yeah, but somewhere you must have this node, right? Right after that node you could do the set input to UI.

Or, you could add this node into the widget and set input to UI afterwards

I have two widgets. One for the Health bars and one for the menu. Should they be together?

7ca9b3b06a6aff0a56bd8acf6fe50806b92bf750.png

Does not matter, but for now I think the simplest is if you go back into the mainmenu widget you showed in your screenshot and add a construct event and after that event you do the set inputmodeuionly with a get playercontroller 0 as the target and self as the widget to focus you should solve it

Like this?

2d3b27d874b46861d169420102e52b3afc9d1514.png

Yeah, does that work?

When I click play it gives me a message saying “infinite loop detected in blueprint: MainMenu1”

Then I have no idea I’m afraid, perhaps someone else can help?

Do you have ‘modal’ checked on the blueprint node. That usually works.

Where do I find that?