Unity SDK EventManager object
The Unity SDK class TezosSDK.Beacon.WalletEventManager
, which is available at runtime as the TezosManager.Instance.EventManager
object, provides events that you can add listeners to.
These events are asynchronous.
For example, if your project makes multiple calls to smart contracts, the ContractCallCompleted
event runs multiple times, not necessarily in the order that you called the contracts.
Example
This code adds a listener for the WalletConnected
and WalletDisconnected
events:
private void Start()
{
TezosManager.Instance.EventManager.WalletConnected += OnWalletConnected;
TezosManager.Instance.EventManager.WalletDisconnected += OnWalletDisconnected;
}
private void OnWalletConnected(WalletInfo walletInfo)
{
Debug.Log(walletInfo.Address);
}
private void OnWalletDisconnected(WalletInfo walletInfo)
{
Debug.Log(walletInfo.Address);
Debug.Log("Wallet disconnected.");
}