Evo uiUi elements
Progress Bar
A flexible progress bar with smoothing
This page documents Evo UI v1. For the current version, see Evo UI v2. Upgrading? Read the migration guide.
Overview
Progress Bar displays a numeric value between a minimum and maximum range and visually represents the percentage using a UI bar. It supports horizontal and vertical fill directions, number formatting, text prefixes, animation smoothing, and both Image fill mode and RectTransform anchor filling.
The component updates its text and fill amount whenever the value changes, and can animate toward its target smoothly using an easing curve.
This is ideal for loading bars, HP bars, XP bars, crafting progress, ability cooldowns, or any UI where a numeric range should be displayed.
Properties
Value
| Name | Type | Description |
|---|---|---|
Value | float | Current value (clamped between MinValue and MaxValue) |
MinValue | float | Minimum limit |
MaxValue | float | Maximum limit |
Settings
| Name | Type | Description |
|---|---|---|
invokeAtStart | bool | Invokes onValueChanged on Start |
isVertical | bool | Uses vertical fill instead of horizontal |
displayMultiplier | float | Multiplier applied before displaying text |
displayFormat | DisplayFormat | Fixed or thousands number formatting |
textFormat | string | Format containing 0 placeholder |
Animation
| Name | Type | Description |
|---|---|---|
enableSmoothing | bool | Enables animated transitions |
smoothingDuration | float | Duration of smoothing animation |
smoothingCurve | AnimationCurve | Easing for smoothed transitions |
References
| Name | Type | Description |
|---|---|---|
fillRect | RectTransform | RectTransform or Image used to visually represent progress |
valueText | TMP_Text | Optional text display for the current value |
Events
| Name | Type | Description |
|---|---|---|
onValueChanged | UnityEvent<float> | Fired when Value changes |
Public Methods
| Name | Parameters | Description |
|---|---|---|
SetValue(newValue) | float | Sets a new value and optionally animates |
SetValueInstant(newValue) | float | Sets value immediately without smoothing |
SetValueWithoutNotify(newValue) | float | Updates visually without triggering onValueChanged |
GetFormatString() | None | Returns format string used internally |
FormatValue(value) | float | Returns formatted text for a value |
Code Example
using UnityEngine;
using Evo.UI;
public class ProgressBarExample : MonoBehaviour
{
public ProgressBar bar;
void Start()
{
// Set values instantly
bar.MinValue = 0;
bar.MaxValue = 200;
bar.SetValueInstant(50);
// Animate to new value
bar.SetValue(150);
// With multiplier and custom text
bar.displayMultiplier = 100;
bar.textFormat = "{0}%";
// Hook event
bar.onValueChanged.AddListener(v =>
{
Debug.Log("Progress updated: " + v);
});
}
void Update()
{
// Example: animate from 0 to max
if (Input.GetKeyDown(KeyCode.Space))
{
bar.SetValue(200);
}
}
}