UOLHpBarWidget::Initialize()
is not an interface. It is just a member method in UOLHpBarWidget
overriding the inherited method UUserWidget::Initialize()
The declaration below just declares a pointer (an empty address in memory)
UCLASS()
class LIFEOFLUCK_API UOLHpBarWidget : public UUserWidget
. . .
protected:
class UProgressBar* HpBar; // HpBar
. . .
at this point HpBae
is nullptr
because there is no object in it. This is why if(HpBar)...
retunrs false and UE_LOG(LogTemp, Error, TEXT("Nooooo HpBar"));
is executed.
The line below creates a progress bar and assigns it to HpBar
bool UOLHpBarWidget::Initialize()
. . .
HpBar = WidgetTree->ConstructWidget<UProgressBar>(UProgressBar::StaticClass());
. . .