UProgressBar
#include "Components/ProgressBar.h" Description
A bar that fills left-to-right (or other directions) proportionally to a 0–1 float value. Use SetPercent() to update at runtime. Supports marquee mode for indeterminate loading states.
Signature
class UProgressBar : public UWidget Caveats & Gotchas
- • Direct property access for Percent, WidgetStyle, and other fields was deprecated in UE 5.1. Use SetPercent() and other setters.
- • SetPercent clamps to [0, 1] — passing values outside this range will not extend the bar.
- • For a health bar that visually smooths to the new value, drive SetPercent() via a timeline or FMath::FInterpTo in Tick rather than setting it directly.
Example
Update health bar C++
void UMyHUDWidget::UpdateHealthBar(float CurrentHealth, float MaxHealth)
{
if (HealthBar)
{
HealthBar->SetPercent(FMath::Clamp(CurrentHealth / MaxHealth, 0.f, 1.f));
}
} See Also
Tags
Version History
Introduced in: 4.5
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?