Without CommonUI, I can directly use an EnhancedInputAction in the widget blueprint with its Started, Completed etc. events firing off when expected.
However, with CommonUI input routing this is no longer possible. I’ve created a custom c++ class derived from UCommonActivatableWidget and added some functions to register input bindings
and I’ve created a non-generic data asset derived from CommonMappingContextMetadata, and set up the input actions to be non-generic. Now when I register a non-generic input action in a widget blueprint, and I can add the input action node
but the issue is, when I press the respective key, Started and Triggered are fired off immediately as expected, but Completed fires off automatically on the next frame, and not when I release the key.
Is there a way to fix this? Am I doing something wrong with binding registration?
Thank you in advance!
void UExtendedCommonActivatableWidget::NativeConstruct()
{
Super::NativeConstruct();
if (!WidgetInputComponent)
{
WidgetInputComponent = NewObject<UEnhancedInputComponent>(this, TEXT("WidgetInputComponent"));
WidgetInputComponent->RegisterComponent();
}
}
void UExtendedCommonActivatableWidget::NativeDestruct()
{
if (WidgetInputComponent)
{
WidgetInputComponent->UnregisterComponent();
}
Super::NativeDestruct();
}
void UExtendedCommonActivatableWidget::NativeOnActivated()
{
Super::NativeOnActivated();
if (APlayerController* PC = GetOwningPlayer())
{
if (WidgetInputComponent)
{
PC->PushInputComponent(WidgetInputComponent);
}
}
}
void UExtendedCommonActivatableWidget::NativeOnDeactivated()
{
if (APlayerController* PC = GetOwningPlayer())
{
if (WidgetInputComponent)
{
PC->PopInputComponent(WidgetInputComponent);
}
}
Super::NativeOnDeactivated();
}
After you do this, you can use any EnhancedInputAction in the widget blueprint and its events will fire off when you expect them to, Started on press, Triggered every tick while held, Completed on Release.
Addition: inGetDesiredInputConfi, InputModeshould be set toAll for it to work