> For the complete documentation index, see [llms.txt](https://docs.sparkframework.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sparkframework.dev/documentation/developer-guide/core-systems/ui-system/events.md).

# Events

All events fired by the Spark UI system. Subscribe via `SparkEventBus.Subscribe<T>()`.

***

## UIPanelShownEvent

Fired when a UI panel is shown/opened.

| Property    | Type      | Description              |
| ----------- | --------- | ------------------------ |
| `Panel`     | `UIPanel` | The panel that was shown |
| `PanelName` | `string`  | The name of the panel    |

```csharp
SparkEventBus.Subscribe<UIPanelShownEvent>(e =>
{
    Debug.Log($"Panel shown: {e.PanelName}");
});
```

***

## UIPanelHiddenEvent

Fired when a UI panel is hidden/closed.

| Property    | Type      | Description               |
| ----------- | --------- | ------------------------- |
| `Panel`     | `UIPanel` | The panel that was hidden |
| `PanelName` | `string`  | The name of the panel     |

***

## FirstUIPanelOpenedEvent

Fired when the first UI panel is opened from a state where no panels were open. Useful for pausing gameplay or showing cursor.

| Property | Type      | Description                     |
| -------- | --------- | ------------------------------- |
| `Panel`  | `UIPanel` | The first panel that was opened |

***

## AllUIPanelsClosedEvent

Fired when the last open UI panel is closed, returning to a state with no panels open. Useful for resuming gameplay or hiding cursor.

***

## EscapeKeyPressedEvent

Fired when the escape key is pressed, allowing systems to respond to the escape action.

***

## ShowEventMessageEvent

Fired to request displaying an event message on screen (e.g., "Quest Completed", "Level Up").

| Property   | Type     | Description                  |
| ---------- | -------- | ---------------------------- |
| `Message`  | `string` | The message text to display  |
| `Duration` | `float`  | How long to show the message |

***

## CloseAllUIPanelsEvent

Fired to request all UI panels to close. Systems can publish this to force-close all panels.

***

## UISkeletonSpawnedEvent

Fired when the UI skeleton (root UI structure) has been spawned and is ready.

| Property   | Type         | Description                         |
| ---------- | ------------ | ----------------------------------- |
| `Skeleton` | `GameObject` | The spawned UI skeleton root object |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.sparkframework.dev/documentation/developer-guide/core-systems/ui-system/events.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
