Timer
Workflow
You can use the timer bar as countdown, indicator, and so on. There are many customization options available, such as; prefixes, suffixes, decimals and more.
Scripting
using UnityEngine;
using Michsky.UI.Hex; // Namespace
public class SampleClass : MonoBehaviour
{
[SerializeField] private TimerBar myBar;
void Start()
{
// Set the current value
myBar.currentValue = 50;
// Set the max timer value
myBar.timerValue = 0;
// Play or pause the timer
myBar.Play(true);
myBar.Play(false);
// Set current value
myBar.SetValue(15f);
// Add dynamic (float) timer events
myBar.onValueChanged.AddListener(TestFunction);
}
void TestFunction(float value)
{
Debug.Log("Current value: " + value.ToString());
}
}
How can we help?
A premium WordPress theme with an integrated Knowledge Base,
providing 24/7 community-based support.