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/binding.md.

UIBindingManager (ACHENGINE_R3)

UIBindingManager is a type-safe pub/sub bus built on R3 Subject<T>. It is enabled only when com.cysharp.r3 is installed.

Publish

public struct GoldChangedMessage
{
    public int Amount;
}

UIBindingManager.Publish(new GoldChangedMessage { Amount = 500 });

Subscribe

Store the returned IDisposable and dispose it when the view is disabled or destroyed.

private IDisposable _subscription;

private void OnEnable()
{
    _subscription = UIBindingManager.Subscribe<GoldChangedMessage>(message =>
    {
        goldLabel.text = message.Amount.ToString();
    });
}

private void OnDisable() => _subscription?.Dispose();

Utilities

bool exists = UIBindingManager.Contains<GoldChangedMessage>();
UIBindingManager.ClearAll();
MethodDescription
Publish<T>(T)Publish a message
Subscribe<T>(Action<T>)Subscribe and return an IDisposable
Contains<T>()Check whether a subject exists
ClearAll()Remove every subject

Without R3, the manager is excluded from compilation.