UI Elements
Progress Button
Hold a button to complete an action
Overview
Progress Button requires a sustained press before completing an action. It is useful for confirmations where an ordinary click would be too easy to trigger.
Usage
Create a Progress Button prefab.
Set Hold Duration and assign a Procedural Shape as Progress Fill.
Connect the action to On Complete.
Choose whether completion remains visible or resets after a delay.
Tips
- The progress and reset curves control the fill animation.
- Stay On Complete keeps the finished state visible; otherwise Complete State Duration controls its delay.
- Configure fill direction on the Procedural Shape.
Public API
Use ProgressButton in the Evo.UI namespace.
Properties
| Name | Type | Description |
|---|---|---|
CurrentProgress | float | Read-only normalized progress. |
CurrentProgressState | ProgressState | Read-only Normal, InProgress, or Complete state. |
IsHolding | bool | Whether a hold is active. |
Fields
| Name | Type | Description |
|---|---|---|
holdDuration | float | Seconds required to complete a hold. |
resetDuration | float | Time used to return the fill after cancellation. |
progressFill | ProceduralShape | Procedural Shape used to display progress. |
Methods
| Name | Parameters | Description |
|---|---|---|
StartProgress() | None | Begins a hold. |
CancelProgress() | None | Cancels the current hold. |
CompleteProgress() | None | Completes the action immediately. |
ResetProgress() | bool instant | Resets the state, optionally without animation. |
SetProgress() | float progress | Sets normalized progress. |
Events
| Name | Type | Description |
|---|---|---|
onProgressStart | UnityEvent | Hold started. |
onProgressUpdate | UnityEvent<float> | Normalized progress changed. |
onComplete | UnityEvent | The action completed. |
onCancel | UnityEvent | The hold was cancelled. |
Example
using UnityEngine;
using Evo.UI;
public class ProgressButtonExample : MonoBehaviour
{
[SerializeField] private ProgressButton target;
private void Start()
{
target.holdDuration = 1.5f;
target.onComplete.AddListener(() => Debug.Log("Confirmed"));
}
}