Skip to main content

Interface IEventService

Namespace: RealityCollective.ServiceFramework.Interfaces

Interface used to implement an event service that is compatible with Unity's EventSystem.

public interface IEventService : IService

Implements​

IService

Properties​

EventListeners​

List of event listeners that are registered to this event service.

IReadOnlyList<GameObject> EventListeners { get; }

Property Value​

IReadOnlyList<GameObject>

Methods​

HandleEvent<T>(BaseEventData, EventFunction<T>)​

The main function for handling and forwarding all events to their intended recipients.

void HandleEvent<T>(BaseEventData eventData, ExecuteEvents.EventFunction<T> eventHandler) where T : IEventSystemHandler

Parameters​

eventData BaseEventData

Event data

eventHandler ExecuteEvents.EventFunction<T>

Event handler delegate

Type Parameters​

T

Event handler interface type

Remarks​

See: https://docs.unity3d.com/Manual/MessagingSystem.html for more information.

Register(GameObject)​

Registers a GameObject to listen for events from this event service.

void Register(GameObject listener)

Parameters​

listener GameObject

GameObject to add to EventListeners.

Unregister(GameObject)​

Unregisters a GameObject from listening for events from this event service.

void Unregister(GameObject listener)

Parameters​

listener GameObject

GameObject to remove from EventListeners.