# EntitySpawned

### Introduction

The EntitySpawned delegate allows custom code to react to an entity instance being created. For example a game may want to add an Entity to a custom list when spawned.

### Code Example

The following code assigns a custom EntitySpawned delegate which adds any created ball instance to the CustomBallList:

```
void CustomInitialize()
{
    BallEntityFactory.EntitySpawned += ReactToBallSpawn;
}

private void ReactToBallSpawn(Entities.BallEntity newObject)
{
    this.CustomBallList.Add(newObject);
}
```


---

# 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.flatredball.com/flatredball/glue-reference/factory/glue-reference-factory-entityspawned.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.
