# UIProgressBar

Kind: Class · Namespace: Sansar.Simulation · Assembly: Sansar.Simulation.dll · Script API 47.10.0

<div class="api-meta">
<span class="api-kind api-kind-class" data-pagefind-filter="kind:Class">Class</span>
<span data-pagefind-filter="namespace:Sansar.Simulation">Namespace <a href="/scripting/api/sansar.simulation"><code>Sansar.Simulation</code></a></span>
<span>Inherits <a href="/scripting/api/sansar.script/instanceinterface">Sansar.Script.InstanceInterface</a></span>
<span class="api-badge api-since">Added in 33.0.0</span>
</div>

<span id="T:Sansar.Simulation.UIProgressBar"></span>

Manages a progress bar UI element.

```csharp
public class UIProgressBar : Sansar.Script.InstanceInterface
```

## Remarks

Used for progress bars on interactions.

## Members at a glance

| Kind | Members |
|---|---|
| **Properties** | [Id](#id) · [Label](#label) |
| **Methods** | [Cancel](#cancel) · [Start](#start) · [ToString](#tostring) |

## Properties

### Id

<div class="api-card">
<span id="P:Sansar.Simulation.UIProgressBar.Id"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 36.3.0</span></div>

```csharp signature
public int Id { get; }
```

The bar&#39;s ID.

<details class="api-remarks"><summary>Remarks</summary>

This ID is only unique to this user&#39;s particular session. It is not globally unique.

</details>

</div>

### Label

<div class="api-card">
<span id="P:Sansar.Simulation.UIProgressBar.Label"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 36.3.0</span></div>

```csharp signature
public string Label { get; }
```

The bar&#39;s current Label

</div>


## Methods

### Cancel

<div class="api-card">
<span id="M:Sansar.Simulation.UIProgressBar.Cancel"></span>
<span id="M:Sansar.Simulation.UIProgressBar.Cancel()"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 33.0.0</span></div>

```csharp signature
public void Cancel()
```

Remove a progress bar.

</div>

### Start

<div class="api-card" id="start-string-single-color">
<span id="M:Sansar.Simulation.UIProgressBar.Start(System.String,System.Single,Sansar.Color)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 33.0.0</span></div>

```csharp signature
public void Start(
    string label,
    float durationSeconds,
    Sansar.Color color
)
```

Start a progress bar.

| Parameter | Type | Description |
|---|---|---|
| `label` | [string](https://learn.microsoft.com/dotnet/api/system.string) | Text of the bar. |
| `durationSeconds` | [float](https://learn.microsoft.com/dotnet/api/system.single) | Duration. |
| `color` | [Sansar.Color](/scripting/api/sansar/color) | Color. |

<details class="api-remarks"><summary>Remarks</summary>

Call this with [`ScriptBase.WaitFor`](/scripting/api/sansar.script/scriptbase#waitfor-action-t-t-t) in a coroutine to block until the event is generated.

</details>

</div>

<div class="api-card" id="start-string-single-color-action">
<span id="M:Sansar.Simulation.UIProgressBar.Start(System.String,System.Single,Sansar.Color,System.Action{Sansar.Script.OperationCompleteEvent})"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 33.0.0</span></div>

```csharp signature
public void Start(
    string label,
    float durationSeconds,
    Sansar.Color color,
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Start a progress bar.

| Parameter | Type | Description |
|---|---|---|
| `label` | [string](https://learn.microsoft.com/dotnet/api/system.string) | Text of the bar. |
| `durationSeconds` | [float](https://learn.microsoft.com/dotnet/api/system.single) | Duration. |
| `color` | [Sansar.Color](/scripting/api/sansar/color) | Color. |
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

<details class="api-remarks"><summary>Remarks</summary>

Call this with [`ScriptBase.WaitFor`](/scripting/api/sansar.script/scriptbase#waitfor-action-t-t-t) in a coroutine to block until the event is generated.

</details>

</div>

### ToString

<div class="api-card">
<span id="M:Sansar.Simulation.UIProgressBar.ToString"></span>
<span id="M:Sansar.Simulation.UIProgressBar.ToString()"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 36.3.0</span></div>

```csharp signature
public override string ToString()
```

A string representation of this object.

**Returns:** [string](https://learn.microsoft.com/dotnet/api/system.string) — A string representation of this object.

<details class="api-remarks"><summary>Remarks</summary>

The format of this string may change between releases.

</details>

</div>


## Used in examples

- [ScriptLibrary/Quest/QuestObjectBase.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/ScriptLibrary/Quest/QuestObjectBase.cs)
- [ScriptLibrary/Scene/ProgressBar.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/ScriptLibrary/Scene/ProgressBar.cs)

<p class="api-generated" data-pagefind-ignore>Generated from the Sansar 47.10.0 client ScriptApi snapshot.</p>