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?
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.
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.: