So I have 2 actors that are children of a character controller class. I create a widget with the code:
.h
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
class UWidgetComponent* HealthBarWidget;
.cpp
this->HealthBarWidget = CreateDefaultSubobject(TEXT(“HealthBarWidget”));
HealthBarWidget->AttachToComponent(RootComponent, FAttachmentTransformRules::KeepRelativeTransform);
HealthBarWidget->SetDrawAtDesiredSize(true);
HealthBarWidget->SetWidgetSpace(EWidgetSpace::Screen);
HealthBarWidget->SetCollisionEnabled(ECollisionEnabled::NoCollision);
This creates the widget that i can add the blueprint widget to as seen here:
However when I load the game I can see the widget on one of the children classes but not the other
Can anyone help tell me what i’m doing wrong here?