Skip to content

Progress Bar

Linear or radial progress indicator with customizable colors and optional label.

Inspector Setup

  1. Add AutoLayout Progress Bar to a GameObject with AutoLayout.
  2. Choose Linear or Radial mode.
  3. Set the initial value and customize colors.
FieldTypeDefaultDescription
ModeProgressBarModeLinearLinear or Radial
Valuefloat0Progress value (0-1)
Track ColorColorDark grayBackground track color
Fill ColorColorLight blueProgress fill color
Show LabelboolfalseDisplay percentage label
Label Formatstring”{0:0%}“Label format string

Linear Mode

FieldTypeDefaultDescription
Fill DirectionLinearFillDirectionLeftToRightFill direction

Radial Mode

FieldTypeDefaultDescription
Start Anglefloat90Arc start angle (0-360)
ClockwisebooltrueFill direction
Arc Rangefloat360Total arc range (0-360)

Code Usage

AutoUI Builder

// Horizontal linear progress bar — set Width/Height on the parent
AutoUI.Create()
.WidthFill().Height(20)
.ProgressBar(ProgressBarMode.Linear)
.Value(0.65f)
.FillColor(Color.green)
.TrackColor(Color.gray)
.ShowLabel()
.Capture(pb => m_LinearBar = pb)
.End()
.Build();
// Vertical linear progress bar — pass direction in the entry call
AutoUI.Create()
.Width(20).HeightFill()
.ProgressBar(ProgressBarMode.Linear, LinearFillDirection.BottomToTop)
.Value(0.4f)
.FillColor(Color.cyan)
.End()
.Build();
// Radial progress bar
AutoUI.Create()
.Size(100, 100)
.ProgressBar(ProgressBarMode.Radial)
.Value(0.75f)
.FillColor(Color.cyan)
.TrackColor(new Color(0.2f, 0.2f, 0.2f))
.ShowLabel()
.LabelFormat("{0:0}%")
.Capture(pb => m_RadialBar = pb)
.End()
.Build();

Sizing note: .ProgressBar(...) does not set Width/Height on the parent — set them yourself before the call. Pick orientation via .ProgressBar(mode, direction) — Linear bars need Width(W).Height(H) for horizontal or Width(W).HeightFill() for vertical.

Runtime Updates

// Update value (fires OnValueChanged)
m_LinearBar.Value = 0.8f;
// Change colors
m_LinearBar.FillColor = Color.red;
m_LinearBar.TrackColor = Color.black;
// Toggle label
m_LinearBar.ShowLabel = true;
// Rebuild visuals (e.g., after switching mode)
m_LinearBar.Mode = ProgressBarMode.Radial;
m_LinearBar.RebuildVisuals();

Methods

MethodDescription
RebuildVisuals()Destroy and recreate children based on current mode

Properties

PropertyTypeDescription
ValuefloatProgress (0-1), clamped
ModeProgressBarModeLinear or Radial
TrackColorColorBackground track color
FillColorColorFill color
ShowLabelboolShow/hide percentage label
LabelFormatstringLabel format string
FillDirectionLinearFillDirectionLinear fill direction
StartAnglefloatRadial start angle
ClockwiseboolRadial fill direction
ArcRangefloatRadial arc range

Events

EventSignatureDescription
OnValueChangedAction<float>Fires when Value changes

Builder API

MethodDescription
.Value(float)Set initial value (0-1)
.FillColor(Color)Set fill color
.TrackColor(Color)Set track color
.ShowLabel()Enable percentage label
.LabelFormat(string)Set label format
.FillDirection(LinearFillDirection)Set linear fill direction
.StartAngle(float)Set radial start angle
.Clockwise(bool)Set radial direction
.ArcRange(float)Set radial arc range
.Capture(Action<AutoLayoutProgressBar>)Capture reference
.End()Return to parent LayoutBuilder

Notes

  • The bar takes whatever Width/Height you set on the parent. There are no auto-defaults — set sizing explicitly before the .ProgressBar(...) call.
  • Label uses zero-GC SetText("{0}", value * 100f) internally.
  • Linear mode uses Image.Type.Filled with Horizontal/Vertical fill method.
  • Radial mode uses Image.Type.Filled with Radial360 fill method.
  • Changing Mode at runtime requires calling RebuildVisuals().