EventList manages a list of callbacks that can be invoked together.
Used for Unity-style events that can be configured in the editor (Unity or Blender).

Serialization:
EventLists are serializable - callbacks configured in Unity/Blender will work at runtime.
Mark fields with @serializable(EventList) for editor support.

Usage patterns:

  • Button click handlers
  • Animation events
  • Custom component callbacks
  • Scene loading events


Screenshot of a Unity component with an EventList field


Screenshot of a Blender component with an EventList field

// Define in your component
@serializable(EventList)
onClick: EventList = new EventList();

// Add listeners
this.onClick.addEventListener(() => console.log("Clicked!"));

// Invoke all listeners
this.onClick.invoke();
const onScore = new EventList<{ points: number }>();
onScore.addEventListener(data => console.log("Scored:", data.points));
onScore.invoke({ points: 100 });
  • CallInfo for individual callback configuration
  • Button for UI button events

Type Parameters

  • TArgs extends any = any

Implements

Constructors

Properties

isEventList: true

checked during instantiate to create a new instance

Accessors

  • get isInvoking(): boolean

    If the event is currently being invoked

    Returns boolean

  • get listenerCount(): number

    How many callback methods are subscribed to this event

    Returns number

Methods

  • Add a new event listener to this event

    Parameters

    • cb: (args: TArgs) => void

    Returns Function

  • Invoke all the methods that are subscribed to this event

    Parameters

    Returns boolean

  • Returns void

  • Parameters

    Returns void

  • set an event target to try invoke the EventTarget dispatchEvent when this EventList is invoked

    Parameters

    • key: string
    • target: object

    Returns void