UMG 3D widgets: focus with gamepad

Hello,

We use UMG 3D widgets with Widget Components in Scene for our GUI. For navigation through the widgets, we use Navigation rules, but for using these rules, we need to have focus set, to a focusable gui widget. With this approach we came across a few problems. Generally, we lose focus from our focusable widget on many occasions. It is stolen from engine calls or it is lost on clicking in the editor. So, we need to find a better solution for focus manipulating. Also, we wonder whether Epic Games have any plans to improve the focus control in their roadmap.

For better understanding the problem, we set focus with function call SetKeyboardFocus(). For example, we set focus to the first focusable button on BeginPlay. Then we use Navigation rules, but in some cases, we lose focus, which must be set back.

Below you can find our specific problems with focus manipulation:

On Console Activation:

First major problem is when we open a console. On console activation, active focus widget is stored and on close console/confirm command, is set back to the stored widget. Problem is when we have focus on our button widget, which is part of 3D widget in scene, then focus is stored and when we type console command e.g. ToggleDebugCamera, focus is set back to the button, but if we want to use debug camera, we need focus on viewport.

Click In Editor:

Second problem is when we Cook and Launch game on Windows No Editor, focus is set to the SViewport widget from GameEngine Tick call, this happens after our 3D widgets initialization with focus setting, so focus is set to the viewport and we can’t navigate through the widgets.

Others:

There are also other problems connected to the focus problem, for example, when click out of viewport in editor, focus is set to some other widget in editor UI and when we click back to editor, focus is set to SViewport, not to the last active widget in Scene.

We found a workaround on these problems. In case of console commands, we set focus manually to the viewport after console is closed and when we click on viewport, we set it back to the stored widget. In case of Cooked build, we set focus to first focusable widget in second tick, after all engine calls. In case of clicking out of viewport, we remembered active (focused) widget and we set it back once player clicks back into the game’s viewport.

These are not the cleanest solutions for these problems, so we want to ask, if there is better approach for focus and its manipulation and if in the future Epic Games plans to do important changes on this topic.

Thanks