Different Huds for Different PlayerControllers - C++

I am trying to make multiple HUDs for different player types, and I’m wondering how I’d go about assigning different huds to different playercontrollers. Ideally I want to assign the HUDs in C++, which I could do in my PlayerController, but I don’t know how to get access to my BP Hud classes.

I could inherit from AHUD and just create/assign a new one to the players, but I think that would get me a level lower than the HUD blueprint, since the blueprint is a child of the inherited class I’d make.

What’s the best way to deal with situation? I’d like to avoid assigning the HUD in blueprint if possible.

Yeaaaaa. That’s pretty much exactly what I needed :slight_smile:

You could use the constructor helper in your PC class to load up the blueprint itself. Here’s the code:
I use similar to load different pawns for each controller. Each pawn has the same custom base class, but each pawn is different, but this code works fine in loading the different pawns etc. Obviously this snippet only loads one object, but you get the idea.

TSubclassOf<AHUD>HUDClass;


    static ConstructorHelpers::FClassFinder<AHUD> HUDObject(TEXT("HUD'/Game/Blueprints/BP_HUD.BP_HUD_C'")); 
    
    	// set default pawn class to our default character
    	if (HUDObject.Class != NULL)
    	{
    		HUDClass = HUDObject.Class;
    
    	}