I have a function that runs every time I open a menu, whose job is to keep the player from moving or looking around, but keep the keyboard enabled (so they can navigate the menu with keys):
This works, but it has a very annoying bug: whenever it fires, it appears to remove focus from the UI, and as a result I need to click on the screen once to restore focus, then again to actually press the button/interface element I’m trying to use. Is there any way to ensure that UMG retains focus, so the first click after a user widget opens will interact with that widget?
Ooh, thank you for the suggestion, I feel silly for not noticing that in the first place! Connecting said node still leads to strange behavior, though: the first time I open a menu with this, it correctly receives focus (and allows me to mouse over/click buttons with no extra steps), but the second and any subsequent time I run the same function, it doesn’t appear to receive focus- none of the UI responds to mouseover, and to interact with any of it I need to click once (anywhere on the screen), which I assume sets the focus, then again to actually use the UI.
Edited to add: I don’t know why this worked, but I solved the problem by cut & pasting the logic that spawns the window from a function in my HUD controller into an event in the controller. Exact same logic, but running from an event instead of a function properly sets focus.