docs
Systems
Messaging
EventSystem
EventSystem Overview

The EventSystem is a domain-routed event messaging layer that enables loosely-coupled communication between game systems. It routes events to handlers based on their target Domain (e.g., Audio, UI, VFX) and maintains a payload of typed parameters for each event.

EventSystem is the backbone of inter-system messaging in SaffronLibrary. It provides a centralized, type-safe mechanism for systems to communicate without direct dependencies on one another.

Key Responsibilities:

  • Create and structure events with a target domain and verb identifier
  • Route events to registered handlers based on their target domain
  • Store and retrieve typed parameter payloads using strongly-typed keys

Who Should Use It: Feature systems (Audio, UI, VFX, etc.) that need to send or receive messages from other systems. They typically subscribe to events in OnEnable and unsubscribe in OnDisable through the ServiceLocator.

Dependencies: Events are dispatched via EventBus, obtained from the BusRegistry through the ServiceLocator. Parameter keys and values are stored in the Params system, which provides type-safe dictionary access. All events target a Domain enum that identifies which system should handle them.