Addressables
Use Addressables to load a GameEventDatabase on demand and make its events available to GameEventManager while the content is in use.
Install com.unity.addressables 1.16.0 or later in Package Manager to enable TinyGiants.GES.Addressables. Add the database to an Addressables group and make sure a GameEventManager exists before you load it.
Pass the database address or GUID to LoadDatabaseAsync. In the success callback, look up an event by its internal event GUID.
using TinyGiants.GES.Addressables;
GameEventAddressables.LoadDatabaseAsync(
"events/combat",
lease =>
{
GameEventBase started = lease.GetEvent("internal-event-guid");
// Retain the lease while this module uses the database
},
exception => Debug.LogException(exception));
Requests and leases
LoadDatabaseAsync returns a GameEventDatabaseLoadRequest. Use Cancel(), Dispose(), or a CancellationToken to cancel a pending request. Only that request is cancelled, and its failure callback receives an OperationCanceledException.
Concurrent requests for the same key share one load. Each success callback receives its own GameEventDatabaseLease. Keep the lease while the content uses the database and dispose it when the content is finished.
Once the final relevant lease is disposed, GES releases the Addressables handle and unregisters the database if the integration registered it. Databases the project registered separately retain that registration.
Lookup and load failures
lease.GetEvent returns null when the internal event GUID cannot be found or the lease is no longer valid. Duplicate internal event GUIDs within the database or across other registered databases send the load request to the failure callback.
See Runtime Databases and Event Queries when your project manages loading and registration itself.