Class ProgressBar
A horizontal progress bar. Note that this element only manages the filling image and value, for a more visually complex progress bar (e.g. with a border), use a Panel (recommended) or GridLayout to overlay the progress bar on a border image.
public sealed class ProgressBar : ArrangableElement, IGameObjectWrapper
- Inheritance
-
ProgressBar
- Implements
- Inherited Members
- Extension Methods
Constructors
ProgressBar(LayoutRoot, Sprite, string)
Creates a progress bar
public ProgressBar(LayoutRoot onLayout, Sprite sprite, string name = "New ProgressBar")
Parameters
onLayout
LayoutRootThe layout root to draw the progress bar on
sprite
SpriteThe sprite to use to render the progress bar
name
stringThe name of the progress bar element
Properties
GameObject
The UnityEngine.GameObject underlying this UI element
public GameObject GameObject { get; }
Property Value
- GameObject
Height
The desired height of the progress bar; it will be scaled as needed
public float Height { get; set; }
Property Value
Sprite
The current sprite underlying the progress bar
public Sprite Sprite { get; set; }
Property Value
Tint
A color to apply over top of the progress bar's image
public Color Tint { get; set; }
Property Value
Value
The value of the progress bar, as a percentage
public float Value { get; set; }
Property Value
Width
The desired width of the progress bar; it will be scaled as needed
public float Width { get; set; }
Property Value
Methods
ArrangeOverride(Vector2)
Internal implementation to position the object within the allocated space.
protected override void ArrangeOverride(Vector2 alignedTopLeftCorner)
Parameters
alignedTopLeftCorner
Vector2The space available for the element.
DestroyOverride()
Internal implementation to perform any additional cleanup when the element is destroyed
protected override void DestroyOverride()
MeasureOverride()
Internal implementation to calculate desired size.
protected override Vector2 MeasureOverride()