Understanding HUD classes.

Hi there!

In the BatteryCollector tutorial we have two declerations for HUD classes.


TSubclassOf <class UUserWidget> HUDWidgetClass;

class UUserWidget* CurrentWidget;

They both inherited(I am totally noob. I don’t even sure if they are inherited. But I don’t have any other words for it.) from UUserWidget. One is having a pointer and I completely miss the other ones point. I also don’t see the connection between two.

So what is the point of TSubclassOf if we are already have a CurrentWidget object?

They’re not quite the same.

  • The pointer is there to ‘point’ to an active instance of the User Widget class.
  • The TSubclassOf is there to ‘point’ to a CLASS of the User Widget (an asset most likely), so that the Hud knows which one to create.

Edit: Also, really annoys me that they named it ‘HUDWidgetClass’ which can be misleading. HUD and Widgets are two different things.