removing widget not working

so im standing infront of a dilema.
here´s the thing:
i want to press esc to open the menu without the character moving in the background, then press esc again to close the widget.

i added the button, gave it a loop, A opens the wiget and the mouse, B closes the widget and the mouse (more or less) BUT the character was moving.


i added “set input UI only” and the character stoped moving


now i can´t close the widget anymore. i tryed adding “set input game mode only” in case of B.
but thats not working.

any suggestions?

Do not use Flip and Input nodes for this as you’re blocking the input this way.

Use Esc to open the menu normally but override OnKeyUp in the widget to restore the Input Mode Game Only:

Add the code to remove self from parent here - this will destroy the widget.

ok i dont´know were to add the code to
remove self from parent there.

Right after Set Input Mode Game Only.

ok i dont´know were to add the code to remove self from parent there.
im not using unreal engine very long.

this is were im currently at:

i made the esc key open the widget normaly and added your code into the widget blueprint

now since the widget hasnt been destroyed it wont close,
but the problem that the character is still moving remains again.

for those who dont know how to “override” in the widget blueprint here is a picture, since i had to look that up first:

Yes, when you Set Input Game UI Only, feed the Game Menu widget Return Value reference into In Widget To Focus:

You may also need to enable isFocusable flag inside of the Game Menu widget for this to work.

When it comes to mouse visibility, you can handle it via the controller - Get Player ControllerSet Show Mouse Cursor.

Widgets, however, override this setting and force the cursor to appear by default. Each widget controls it separately, though - there is a small hidden tab in the Behaviour panel of each widget. This will allow you to individually control cursor behaviour over every single one of them:


Hope this makes sense.

ok ive “set input mode to UI only” back into the level blueprint again and your suggestion is working.
but. i have to click onto the widget befor it can disapear and my mouse is still visible.
do you have a solution for this? im guessing this would be a more complext matter to solve at a later state.

Thank you for your support :slight_smile:

found it. sadly this did not work. this is what happend:
the menu was only visible when i held down the ECS button due to “isFocusable”

i still need to click on it in order to cancel it

and the mouse is still there when i set Curser behavior to True no matter if i use none or default.

the problem remains

Edit: wrong panel, but its not working in the right one too.
Hint: the mouse is invisable untill i open the menu, duno if that helps

oh this is my bad! i meant: my mouse is stil visible when i have closed the menu. sry for that!

You’ve marked it as resolved. Does it mean you got it to work the way you need it to?

I’m not sure what you expect from the mouse? You want it hidden in game and show in the menus, right?

Makes sense.

In this case I would hide the mouse cursor in the controller. Leave the widgets cursor settings at their default values and then:

  • open the menu, show the cursor via player controller; maybe even position it in the centre of the widget for extra fanciness…
  • onKeyUp, do the stuff you’re doing and just before removing the widget from the parent, get player controller and hide the cursor again

That should work like a charm. Good luck with the rest!

i marked my main question as solved “closing the widget”
but your solution that solved my main problem, brought up some issues.
i do not wish to see my mouse in the game. i only wish to see it in the menu.
i used to have a solution for this. “flip flop”. but that is now gone with your solution.
i am creating a first person shooter. this should give more sense to the topic.

this is my solution since the widget apparently has its own cursor.
“Widgets have their own cursor control and you get to choose whether to show the cursor or not.”

its working now. thank you very much :slight_smile: