Basically, when I shoot my Client, his Health Bar does not update.
He still takes damage and dies, it’s just that his healthbar does not update.
This is the Widget Blueprint:
http://i.imgur.com/zeSyaKY.png
I set my HUD in the GameMode (is this the culprit?):
HUDClass = AProjectZ_SurvivorHUD::StaticClass();
I create my HealthBarWidget in the HUD:
void AProjectZ_SurvivorHUD::PostInitializeComponents()
{
Super::PostInitializeComponents();
if (widgetHealthBar && GetOwningPlayerController()->IsLocalController())
{
HealthBar = Cast<UHealthBarBaseWidget>(CreateWidget<UUserWidget>(GetOwningPlayerController(), widgetHealthBar));
/*
if (HealthBar)
{
HealthBar->AddToViewport();
}
*/
}
}
I add it to viewport in the PlayerController:
void AProjectZPlayerController::BeginPlay()
{
Super::BeginPlay();
if (IsLocalPlayerController())
{
HUD = Cast<AProjectZ_SurvivorHUD>(GetHUD());
if (HUD)
{
HUD->GetHealthBarWidget()->AddToViewport();
}
}
}
Health and MaxHealth are Replicated and seem to work! The player loses health and dies!
It’s probably something obvious I’m missing?
Thanks in advance guys!