UMG Mouse Vanishes After Clicking Background

Reproduce:

  • Set input mode is set to UI only
  • Display widget in game
  • If you now click with the mouse on the background widget (everything but the green button) the mouse disappears
  • Workaround: If you set the background widget to IsFocusable and visibility to visible the mouse no longer vanishes but the background widget now has the focus which unfocuses any buttons which you may need for keyboard/gamepad navigation

Expected:

  • Mouse should not vanish if clicking on non-focusable widget

Regression since this was working before (last tested in 4.8.3)

Hello dgrieshofer,

Have you tried using “Set show mouse cursor” and setting it to true? If I understand you correctly this should allow you to use the mouse without having to set the focus or visibility of the widget. I hope that this information helps.

Make it a great day

1 Like

Hey Rudy, I tried this just now and it behaves exactly like the workaround I mentioned and still does not fix it properly. The mouse is always visible but focus still gets lost when clicking in background and I would like to have it stay on the button for key/gamepad navigation. Just like it was in earlier versions.

Hello dgrieshofer,

Could you provide the exact method that you were using in older versions of the engine to get the desired effect? Could you also state what the newest version of the engine it is that the method works in?

Sure, simply create a new UMG widget with multiple buttons which you can navigate through using mouse buttons and open widget like on screenshot below to focus the first (called resume button here). Then in game after opening it (P key) click in background and it should still show mouse and not change focus however right now mouse vanishes and keyboard focus (dotted line, shown after navigating to any other button using arrow keys) from button gets lost (only former is fixable with workaround). Unfortunately I don’t have the time to test all versions between 4.8.3 (worked there) and 4.13. Thank you.

Hello dgrieshofer,

After further testing, it appears that this is working as intended. If you would like for the focus not to change when clicking off of the buttons, you could set this up using a mixture of the on mouse button down function and set focus. I have provided a link below to another answerhub thread that is similar. You may find the information helpful.

Link: [bug] losing focus when clicking in level view - UI - Epic Developer Community Forums

Make it a great day

Hello Rudy, thanks for looking into that. However I feel like the viewport should not get focus and mouse should not vanish if the whole canvas is set to to receive mouse input without being focusable. This would then fix it properly and is also how it worked before based on that linked question (“setting the canvas to visibility true and inputmode to UIOnly, but it seems that this is not enough anymore in 4.12”)- Or maybe that is already UE-32647, I can’t tell since it is not visible in the public issue tracker.