How do I set keyboard focus to a 3D widget (that was not added to viewport) via blueprints?
I have a UMG UserWidget, which extends a C++ UserWidget.
bIsFocusable is set on the widget. The widget is placed on an Actor (via WidgetComponent) and placed in the scene/map.
I am trying to set the user focus on the widget, such that I can check “Has User Focus” in blueprints when listening for input. The goal is to get the keyboard to work on the menu (in 3D) without adding it to the viewport.
[Method for creating 3D Widgets from the tutorial] no longer seems to work.
[Method for using WidgetInteractionComponent] seems to only target mouse/look-at interaction, i.e. “The Widget Interaction component performs a Raycast to see if it hits a Widget Component placed in the world and if it hits one, you can set up rules to determine how to interact with it.”
Here is what I’ve tried so far, both in the node graph of the Actor that houses the widget, called “LeftMenuPlane”, (starting with Event BeginPlay, as shown, and in the node graph of the UMG widget itself starting with the “Construct” event. Unfortunately, when I check “Has User Focus” (as shown below) it always returns false, even after immediately setting it. Please advise.
- Perhaps there is a way to simply hide the widget on the viewport after in fact adding it, i.e. by overriding some method in a custom HUD subclass & using that instead of the default? Which method would I want to override?
- Perhaps I can place a [WidgetInteractionComponent] overlapping some component within the widget in 3D in order to set keyboard focus on it? How would I do that? Will the user then be able to use the keyboard to switch focus to other components of the widget?
V1. Set Input Game Mode and UI Node
V2. Set User Focus
V3. “Set Input Game Mode and UI Node” followed by “Set User Focus”