# Event System

Since version 0.9.1 **Game Creator** comes with a fully fledge **Event System** that is built on top of **Triggers** and **Actions** for maximum flexibility.

## Event System 101

When a game object (yellow) wants to communicate a state change to other game objects (blue ones) it normally has to iterate over all these objects and notify them one by one about the change.

![](/files/-Le6bTfxxg3Vgc1rjkO7)

This is okay for small scale and non-dynamic systems, but it can quickly become a mess. An **Event System** flips the system upside down, making objects *subscribe* to a proxy that observes the object with the state change, and communicates it when the change happens.

![](/files/-Le6cBVPX8HS3M3Ugrib)

By doing so we translate the responsibility of keeping a list of objects that need to be notified from the yellow object to each individual blue object.

## Dispatch an Event

To dispatch an **Event** all that is needed is to call the **Dispatch Event Action**. This **Action** needs a string field which is the **name** of the event.

![(A Dispatch Event Action using "my-event" as the name of the Event)](/files/-Le6i_9wXpWMvfRoE_2J)

{% hint style="info" %}
The name of the **Event** dispatched can be whatever the developer wants.
{% endhint %}

## Receive an Event

An object can listen to events dispatched using the **On Receive Event Trigger**. This **Trigger** will be called every time an event with a specific name is raised.

![(Trigger set to detect when a "my-event" Event is dispatched)](/files/-Le6kLvw7S2FuUtMvLPt)

Optionally, the invoker of this event can be saved in a **Variable** to lately reference the caller from within an **Action** or a **Condition**.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gamecreator.one/game-creator/systems/event-system.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
