> For the complete documentation index, see [llms.txt](https://docs.flatredball.com/flatredball/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flatredball.com/flatredball/gum/animations/named-events.md).

# Named Events

### Introduction

Named events can be used to perform custom logic at certain times in an animation. Since named events are created in Gum, the animator can align the performance of logic visually. For example, a Gum animation may be used to move components of a title screen into view. While this animation is playing the game may need to play sound effects and music at certain times. Named events can be used to play music and sound effects at certain times.

### Example

Named events can be added to animations in Gum in the animation window. To add a named event to an existing animation:

1. Select the animation
2. Click the **Add Named Event** button
3. Enter a name for the event
4. Select the event
5. Enter a time for the event

![](/files/67zlH2HZAXaQuOK6R9AT)

Gum animations have an AddAction method which can be used to add custom actions at certain times: For example, if the screen were accessible in code as GameScreenGumRuntime in a Glue screen, the MakeYellow named event could be reacted to as shown in the following code:

```lang:c#
void CustomInitialize()
{
    // AddAction can be used to handle the MakeYellow named event
    GameScreenGumRuntime.MoveToLeftAnimation.AddAction("MakeYellow", HandleMakeYellow);
}

// HandleMakeYellow can be used to handle the event:
private void HandleMakeYellow()
{
    
}
```


---

# 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.flatredball.com/flatredball/gum/animations/named-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.
