Hi, I have been trying for the last several hours trying to get my HUD class to display the player’s health in the HUD as numerical value, but have had no success on getting my code to update the player’s current health status i.e. when my player receives damage it still displays the player’s health at 100 or if set the value below 100 and use a health pickup it still displays the reduced value any help on this issue would be appreciated. I will include a code snippet below.
.
// Print the players health
AShooterRPGCharacter* Player = Cast<AShooterRPGCharacter>(UGameplayStatics::GetPlayerPawn(this, 0));
const float HealthAmount = Player->Health / Player->GetMaxHealth();
FString HealthString = FString::Printf(TEXT("Health %10.f"), HealthAmount);
DrawText(HealthString, FColor::Yellow, 25, 750, HUDFont);