I need advice about multiple HUDs...

Since my game is a bit complicated 2D RPGs, I may need a various HUDs -> Battle, Dialogues(conversation), and so on.

The problem… is… whether I tried BP or C++, I cannot set specific HUDs as I want.

ClientSetHUD(NewHUDClass); in Player Controller? the problem is… My HUD is the class which being inherited from AHUD, I don’t have any clue (I did googling too) how to convert from my AHUD child class to TSubclassof<AHUD>

Maybe I tried too difficult way. but I don’t want to put every widgets into one HUD, which does not seems right… is it?

p.s. I used to create widgets in PlayerController class… is it correct?

some post mentioned don’t use Player Controller to create Widgets… but I also remember that using HUD as storing widgets. I feel complicated… help.

I create all my widgets in the HUD and store them there, and use the HUDs Player Controller as the widget’s owner. Generally speaking, a good design is to treat the HUD as a Widget Manager - you should be able to access most if not all of your widgets from there.

You can’t create multiple HUD’s for one player, but you can have as many widgets as you like.

Thank you :slight_smile:

Just like you helped me before, I am thinking about ConstructorHelper to get classes of Widget. But Unreal Engine (or Visual Studio) cannot use ConstructorHelper in Constructor function. Even I tried Dynamic Object Loader. everything fails… I am clueless again

Don’t use that, you should avoid hardcoded references where you can. Just create UPROPERTY varaibles in your HUD class, and crreate a blueprint-derived HUD and set the widgets. E.g.:

UPROPERTY(EditDefaultsOnly, Category = "Widgets"
TSubclassOf<UUserWidget> WidgetToUse;

okay… after that I should initialize them all?

edit. I mean…Creating blueprint derived from HUD class… how do i use them? In BP? or C++ of Player Controller?
I kinda solved it.