A ProgressBar element displays the progress of an ongoing task or process. Use it to provide visual feedback to the user about the progress of a task, such as file downloads, game level loading, or any other task that may take a while to complete.
You can create a ProgressBar with UI Builder, UXML, and C#.
To create a ProgressBar with C#, create a new instance of a ProgressBar object. For example:
ProgressBar myElement = new ProgressBar("Label text");
To change the style of the bar, use the .unity-progress-bar__progress
USS selector. For example, the following USS changes the size and the color of the bar:
.unity-progress-bar__progress {
width: 20px;
height: 50px;
background-color: yellow;
}
C# class: ProgressBar
Namespace: UnityEngine.UIElements
Base class: AbstractProgressBar
This element inherits the following attributes from its base class:
Name | 타입 | 설명 |
---|---|---|
binding-path |
string |
Path of the target property to be bound. |
focusable |
boolean |
True if the element can be focused. |
high-value |
float |
Sets the maximum value of the ProgressBar. |
low-value |
float |
Sets the minimum value of the ProgressBar. |
tabindex |
int |
An integer used to sort focusables in the focus ring. Must be greater than or equal to zero. |
title |
string |
Sets the title of the ProgressBar that displays in the center of the control. |
value |
float |
Sets the progress value. If the value has changed, dispatches an ChangeEvent_1 of type float. |
This element also inherits the following attributes from VisualElement<