> 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/api/flatredball/math/attachablelist/findbyname.md).

# FindByName

### Introduction

The FindByName method returns the first object in the list with the name matching the argument. The signature for the method is:

```
public T FindByName(string nameToSearchFor)
```

### Common Usage

The FindByName method is most commonly used on AttachableLists which are populated by data which is loaded from file (or through the content pipeline), such as lists contained in [Scenes](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) or [ShapeCollections](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php). For example, a .scnx may be created as the level for a platform game. The goal of the level is to reach a door, which is a [Sprite](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) in the .scnx. This requires special logic (collision tests, then advancing to the next level on a successful collision). To perform this logic, the code that's loading the .scnx needs to have reference to the door Sprite. To accomplish this, the person assembling the .scnx should appropriately name the door and communicate this to the programmer. We'll assume that the door is named "door". Add the following code to get a handle to this object:

```
// likely at class scope
Sprite mDoor;

// After loading the .scnx into a Scene:
mDoor = scene.Sprites.FindByName("door");
// now mDoor can be used however needed
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flatredball.com/flatredball/api/flatredball/math/attachablelist/findbyname.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
