IEventService

Event Service

Interface

This service provides alternative methods to subscribe to events, since the Creator Toolkit prohibits direct access events outside of the SpatialSDK namespace.

Remarks

Spatial limits the ability to directly subscribe to C# events, UnityEvents, and to register callback functions. However, this is still possible using the utility methods in this service.

Methods

AddEventHandler(object, string, Delegate)

Adds eventHandler to the event named eventName on the target object. Equivalent to target.eventName += eventHandler;

AddStaticEventHandler(Type, string, Delegate)

Adds eventHandler to the static event named eventName on the targetType type. Equivalent to targetType.eventName += eventHandler;

AddVisualScriptEventHandler<TArgs>(EventHook, Action<TArgs>)
RemoveEventHandler(object, string, Delegate)

Removes eventHandler from the event named eventName on the target object. Equivalent to target.eventName -= eventHandler;

RemoveStaticEventHandler(Type, string, Delegate)

Removes eventHandler from the static event named eventName on the targetType type. Equivalent to targetType.eventName -= eventHandler;

RemoveVisualScriptEventHandler(EventHook, Delegate)

Adds eventHandler from the EventHook 'hook' Equivalent to EventBus.Unregister(hook, eventHandler);