I have created a new class (called myHUD) that derives from HUD, how do I get this class to get called though? I have made a blueprint that derives from myHUD
I have tried this in Character.h:
static ConstructorHelpers::FObjectFinder<UBlueprint> HUDBlueprint(TEXT("Blueprint'/Game/Blueprints/UI/Bp_HUD.Bp_HUD'"));
if (HUDBlueprint.Succeeded())
{
myHUD = (UClass*)HUDBlueprint.Object->GeneratedClass;
}
I thought this would call my class functions, however this function in myHUD never get calls. The breakpoint never hits.
You can’t call draw functions from tick. The draw functions are basically used in a special phase of the game loop where the renderer is ready to receive such commands. Instead, override DrawHUD() and call your drawing methods in there:
Yeah. I overlooked that in the OP, but you shouldn’t be assigning this class in your Character, as the character has no notion of the HUD being used. The sample I posted assigns the hud class to HUDClass, which is a property of AGameMode. Create yourself a GameMode, set the class there, and you should be all set.