For AI agents: the complete documentation index is available at /AchEngine/en/llms.txt, the full documentation bundle is available at /AchEngine/en/llms-full.txt, and this page is available as Markdown at /AchEngine/en/usage/ui/button-extras.md.

Button Extension Components

AchButtonCooldown and AchButtonHold are components added beside a standard Unity Button. Both require a Button on the same GameObject.

AchButtonCooldown

Disables the button after a click and enables it again after the configured duration. It can display a countdown label.

Inspector fieldDescription
CooldownMinimum delay in seconds; default 1
Show CountdownDisplay remaining time
Countdown LabelOptional Text target
On Cooldown StartUnityEvent fired at start
On Cooldown EndUnityEvent fired at end
APIDescription
IsCoolingDownCurrent state
StartCooldown()Start or restart the cooldown
ResetCooldown()Clear the cooldown and re-enable the button
var cooldown = GetComponent<AchButtonCooldown>();
cooldown.StartCooldown();
cooldown.ResetCooldown();
if (!cooldown.IsCoolingDown)
    Debug.Log("Button is ready");

AchButtonHold

Fires a UnityEvent repeatedly while the button is held. It is useful for quantity controls and volume adjustments.

Inspector fieldDescription
Initial DelayDelay before the first repeat; default 0.5
Repeat IntervalTime between repeats; default 0.1
On Hold FireRepeated UnityEvent
APIDescription
IsHoldingWhether the button is currently held
public void IncreaseVolume()
{
    AudioManager.Volume = Mathf.Clamp01(AudioManager.Volume + 0.05f);
}

Use both components

[Button GameObject]
├── Button
├── AchButtonCooldown
└── AchButtonHold