publicclassEventListener:MonoBehaviour{publicDataLibrary data; [DataObjectDropdown("data")]publicMyEvent myEvent;publicvoidStart() { // As with all DataObjects we have to make sure the DataLibrary is ready // before using it.data.RegisterInitializationCallback(Ready); }voidReady() { // DataLibrary is ready. We can now register to the eventmyEvent.RegisterListener(EventCalled); }voidEventCalled(MyEventData _data) { // Event has been calledDebug.Log("EVENT CALLED "+_data.param1+" _ "+_data.param2); }}
Global DatabrainEvent
You can also use the base type - DatabrainEvent for global events which do not require any parameters.