Download

ListenForInputAction in C++

Hi, there!

I have a function to create User Widget:

UUserWidget* APZ_GameHUD::CreateStaticAdviceWD(TSubclassOf Widget)
{
UUserWidget* LAdviceWD = CreateWidget(GetWorld(), Widget);
LAdviceWD->AddToViewport();
UGameplayStatics::SetGamePaused(GetWorld(), true);
UUserWidget::ListenForInputAction(TEXT(“Jump”), IE_Pressed, true, FOnInputAction Callback)
return LAdviceWD;
}

And function of destruction:

void APZ_GameHUD::DestroyWidgetWD(UUserWidget* Widget)
{
if(UGameplayStatics::GetGameMode(this)->IsPaused() == true)
{
UGameplayStatics::SetGamePaused(GetWorld(), false);
}
Widget->RemoveFromParent();
}

How can I create the last parameter to use this function to call function of destruction with 1 parameter?

UUserWidget::ListenForInputAction(TEXT(“Jump”), IE_Pressed, true, FOnInputAction Callback)

If case it helps anyone, this function only works in widget class or child classes, because it is a protected function.