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/red-dot.md.

RedDot System

RedDot is a static facade for notification badges. Keys separated by / form a hierarchy, and child counts are aggregated into their parents.

API

RedDot.Set("Shop/New", 3);
RedDot.Add("Quest/Daily", 1);
int count = RedDot.Get("Shop");
bool visible = RedDot.HasDot("Shop");
RedDot.Clear("Quest/Daily");
RedDot.Subscribe("Shop", OnShopChanged);
RedDot.Unsubscribe("Shop", OnShopChanged);

RedDot.ClearAll() resets every key to zero, which is useful during scene transitions or a new game session.

RedDot.ClearAll();
SceneManager.LoadScene("MainMenu");

Hierarchy

Shop       → Shop/New + Shop/Sale
Shop/New   → direct count
Shop/Sale  → direct count

RedDotBadge

Attach RedDotBadge to a UI object to toggle a dot object and optional count label automatically.

FieldDescription
KeyKey to observe, such as Shop or Quest/Daily
DotGameObject enabled when count > 0
Count LabelOptional Text; shown for counts of 2 or more
Clear On ClickAutomatically clear on button click; default true
ButtonButton used for click clearing

The component subscribes in OnEnable and unsubscribes in OnDisable.

Direct subscription

private void OnEnable() => RedDot.Subscribe("Shop", OnShopChanged);
private void OnDisable() => RedDot.Unsubscribe("Shop", OnShopChanged);

private void OnShopChanged(int count)
{
    _shopButton.SetDotVisible(count > 0);
}

RedDot resets its static state on SubsystemRegistration, so it also works when Enter Play Mode is configured without Domain Reload.