Bug with Widget's menu

Hello,

In my mod I have a menu in a widget. The widget is always active in the viewport, but the menu is visible/invisible by pressing ‘N’. This is done by this piece of coding:

Some players of my mod having the problem with a bug: The menu is visible, but not clickable, when they click they see the punch animation. This is probably because the input mode is set to game only.

What in the coding is causing this bug?

The second input change will need to be UI only, and use the owning player node for the mouse cursor as well.

Also, double check the ZOrder of your elements in your widget, if anything you want to be clickable is covered by something with a higher ZOrder it will block it.

-WM

If I change the input to UI only, i cant close the menu. This is done by pressing N. So this will not work.

Only thing I can think of then would be to use the capture mouse boolean on the widget itself… but I’ve had issues with this, my admin UI has gone completely mental and the mouse is glitching like mad for people using it but I don’t have the issue on my singleplayer or my dedicated so I don’t actually know what’s causing it.

How are you handling the adding of the UI to the viewport?

-WM

The widget is added by the HUD in the Event Begin Play. With the ‘Add to viewport’ nod. It doesn’t get removed, the only thing that changes is the visibility of the menu.

Well, with visibility I would suggest using either collapsed or self hit test invisible for when the UI is not to be seen/used, but that’s just my thoughts on it.

Have you checked your ZOrders? Also, you could experiment with the capture mouse, just be sure to set capture mouse to false when you’re running the code that changes the input lock and visibility.

-WM

Zorders of the menu are set to 1. What does capture mouse exactly?

It tells the widget whether or not to capture mouse input. If you set it manually, it must be disabled manually otherwise it will go screwy when you try to open another UI element(inventory and the like).

Ok, so everything is set to 1? Move everything you don’t want to be clicked on or doesn’t need to be clicked on to 0 or a negative number. Make sure that none of the elements you want to be clickable are disabled or set to hit test invisible… the DevKit has issues when it comes to UI things, it may have changed things without your knowledge, it certainly did to me.

-WM

The rest of the widget has a ZOrder of 0. All the button are enabled. I think this is not the problem.

So if I do this, will it work better:
Event Tick -> set Capture Mouse input to visibility of the menu. (So if menu is visible the widget captures the mouse input).

I can’t say if it will work better, as I’ve had my issues but mine could be completely unrelated also. Just test it out in PIE with single and dedicated testing and see if the widget works as intended.

That flow should work, yes, but be sure to put the capture mouse and everything after you set the visibility and all that.

-WM

Do some more research. The bug occurs sometimes when players bring up the pause menu or level up, but it occurs very random.
Sometimes only a few buttons of the menu stop working.

What is the cause, is it something in the engine or my mistake?