How to use a c++ game mode and blueprint HUD?

I’m trying to use a blueprint HUD with my project. However, since my game mode is in c++…

I’ve created a c++ class which extends AHUD, reparented the hud blueprint to it, and set the static class in the game mode constructor, but the Recieve Draw HUD Event still isn’t firing.

//MaximumTopSpinGameMode.cpp
AMaximumTopSpinGameMode::AMaximumTopSpinGameMode(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
	DefaultPawnClass = AMaximumTopSpinBall::StaticClass();
	HUDClass = ABallPlayerHUD::StaticClass();
}

In the last picture you can see the blueprint is reparented and the game is playing, but the Recieve Draw HUD Event isn’t firing. I can’t tell whether I need to fire the event from the gamemode.cpp or what. I’ve looked at the gamemode and hud api documentation, but couldn’t find anything useful there. What’s missing to make my blueprint’s event fire? Do I have to do my entire HUD in C++ instead?

Well, I haven’t found an appropriate solution. Seems the best thing to do is scrap the blueprint and do the HUD in C++ as well.

I’m having a similar problem but I can still do the HUD in C++ if I have to, do you guys have some links or some documentation for building a HUD in C++?

Untested solution! But I found this question when I was trying to fix the same problem.

What might work is using the FObjectFinder to point to the blueprint class:

AMenuGameMode.cpp

AMenuGameMode::AMenuGameMode(const class FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
    static ConstructorHelpers::FObjectFinder<UClass> test(TEXT("/Game/ThirdPersonBP/Blueprints/MenuHudBP.MenuHudBP_C"));
    DefaultPawnClass = AMenuPawn::StaticClass();
    HUDClass = test.Object;
    PlayerControllerClass = AMenuPlayerController::StaticClass();
}

The string path is a rewrite form the path you get when you right click on a blueprint class and select “Copy reference”

Easiest way would be to create a BP of your GameMode.

You don’t have to put any logic in it, just use it to reference the HUD.

Create the BP and put that into Maps & Nodes under the project settings. Now you can easily create the BP HUD and select it in the options for your standard HUD Class.

Your DrawHUD isn’t firing, because you have used the Parent Class for the standard HUD Class. So it is only calling the DrawHUD of that class. You need to use the BP Class. So do it like i told you above and it will work (: