Class BudgetIndicator
The same budget as ChatBudget, compressed into a titlebar-sized readout.
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
[UxmlElement]
public class BudgetIndicator : BaseVisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder
Remarks
Shows the amount spent, the percentage, and a ring that fills to match, with the full "spent / total unit" reading in the tooltip. A non-positive total hides the whole indicator: there is no budget to report on.
The ring is a determinate CircularProgress, so it is the package's own ring rather than a second one drawn by hand.
Examples
A titlebar readout.
var indicator = new BudgetIndicator { spent = 40, total = 200 };
parentElement.Add(indicator);
In UXML.
<appui:BudgetIndicator spent="200" total="200" unit="pts" />
Constructors
BudgetIndicator()
Default constructor.
Declaration
public BudgetIndicator()
Fields
amountUssClassName
The styling class of the spent amount.
Declaration
public const string amountUssClassName = "appui-budget-indicator__amount"
Field Value
| Type | Description |
|---|---|
| string |
exhaustedUssClassName
The styling class applied once the budget is used up.
Declaration
public const string exhaustedUssClassName = "appui-budget-indicator--exhausted"
Field Value
| Type | Description |
|---|---|
| string |
percentUssClassName
The styling class of the percentage.
Declaration
public const string percentUssClassName = "appui-budget-indicator__percent"
Field Value
| Type | Description |
|---|---|
| string |
ringUssClassName
The styling class of the ring.
Declaration
public const string ringUssClassName = "appui-budget-indicator__ring"
Field Value
| Type | Description |
|---|---|
| string |
ussClassName
The BudgetIndicator main styling class.
Declaration
public const string ussClassName = "appui-budget-indicator"
Field Value
| Type | Description |
|---|---|
| string |
Properties
exhausted
Whether the budget is used up.
Declaration
public bool exhausted { get; }
Property Value
| Type | Description |
|---|---|
| bool |
percent
How full the budget is, as a whole percentage.
Declaration
public int percent { get; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
Rounded half up, like the registry's Math.round. Mathf.RoundToInt rounds a
midpoint to even, so 20.5% would report 20 there and 21 on the web.
progress
How full the budget is, from 0 to 1.
Declaration
public float progress { get; }
Property Value
| Type | Description |
|---|---|
| float |
ring
The ring the budget fills.
Declaration
public CircularProgress ring { get; }
Property Value
| Type | Description |
|---|---|
| CircularProgress |
spent
How much of the budget has been spent.
Declaration
[CreateProperty]
[UxmlAttribute]
public float spent { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
tooltipLabel
Replaces the default "spent / total unit" tooltip.
Declaration
[CreateProperty]
[UxmlAttribute]
public string tooltipLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
total
The size of the budget. Non-positive hides the indicator.
Declaration
[CreateProperty]
[UxmlAttribute]
public float total { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
unit
The unit suffix. "pts" by default.
Declaration
[CreateProperty]
[UxmlAttribute]
public string unit { get; set; }
Property Value
| Type | Description |
|---|---|
| string |