Handling Input in NoesisGUI for Unreal Engine (Potential bug with NoesisInstance key mappings?)
Posted: 22 Mar 2024, 12:28
Hi There,
I am currently working on supporting input on my in game menus in Unreal Engine. I have a main menu that can be opened pressing ESC or Start button on a controller and that is handled by Noesis using the xaml binding below:
When the menu is opened the following code is ran to switch the input mode to UI only, this is so movement input isn't propagated to the controller causing the possessed pawn to move whilst a menu is open:
The issue I am having is that it appears that the widget is not responsible for its user inputs. When I switch to UI only and set the instance to be the focused widget, all input is suppressed, meaning I cannot close the menu once opened and I cannot navigate the menu using directional inputs using a controller. This gives me the impression that Noesis gets its UI input from the player controller? Is there a way to change this so that it handles its own input? I could in theory have a state bool that stores if the user is currently on the menu, but I'd rather use the input mode feature built into unreal
I am currently working on supporting input on my in game menus in Unreal Engine. I have a main menu that can be opened pressing ESC or Start button on a controller and that is handled by Noesis using the xaml binding below:
Code: Select all
<noesis:InputActionTrigger Action="Pause" Type="Pressed" Consume="False">
<b:InvokeCommandAction Command="{Binding ToggleLocationSelector}"/>
</noesis:InputActionTrigger>
Code: Select all
// Where location selector is my ViewModel object - I set it to null if I am closing the menu
if (LocationSelector)
{
LocationSelector->Initialise(UserController);
if (NoesisInstance)
{
auto InputMode = FInputModeUIOnly();
InputMode.SetWidgetToFocus(NoesisInstance->GetCachedWidget());
UserController->SetInputMode(InputMode);
}
}
else
{
if (NoesisInstance)
{
auto InputMode = FInputModeGameAndUI();
InputMode.SetWidgetToFocus(NoesisInstance->GetCachedWidget());
UserController->SetInputMode(InputMode);
}
}