Slate FReply handling

I set up a menu following this tutorial. So my menu has two events PlayGameClicked and QuitGameClicked. Everything works fine up to the point where I want to handle those events via blueprint. I created a blueprint based on the HUD class and added the events and some behavior to the EventGraph. The blueprint HUD is set as HUD of the world. But when I click the buttons only the print from MainMenuUI is made and the blueprint events aren’t triggered. I tried changing


return FReply::Handled()

to


return FReplay::Unhandled()

but that makes no difference.

So my question is: What do I have to do to implement the button behavior via blueprint? Is there some mistake in the code so the HUD doesn’t even know the events took place? Or is there some other problem?

If your prints are being called, then the function is being called and the reply won’t change anything.

What a handled reply does is prevent the event from bubbling up to parent widgets. So, say you had a button containing another button, if the inner button replies Unhandled to MouseDown, the event will bubble up to the outer button and give it a chance to handle MouseDown as well. Normally, you’ll want to return Handled when you do something with the event. (There are exceptions to this rule, but this is not one of those cases.)

If you’re just following the tutorial as-is, then the SMainMenuUI::PlayGameClicked()/SMainMenuUI::QuitGameClicked() handlers are not actually calling the events on MainMenuHUD. Add a MainMenuHUD->PlayGameClicked() and MainMenuHUD->QuitGameClicked() respectively in each handler, that should fill the missing link to calling your blueprint events.

Thank you, it is working now!

Actually I thought by returning the FReply the engine calls the events in parent classes. But I always have to do this manually, right?