# ShapeCollection

### Introduction

The FlatRedBall Editor supports creating objects of type ShapeCollection.

Note that entities which are created as ICollidable automatically have a ShapeCollection named Collision, and all shapes shapes are added to the default Collision shape collection. In this case you do not need to manually create a ShapeCollection. For more information, see the [Implements ICollidable](/flatredball/glue-reference/entities/glue-reference-implements-icollidable.md) page.

### Adding a ShapeCollection

To add a ShapeCollection:

1. Right-click on Objects under a Screen or Entity
2. Select **Add Object**
3. Verify that **FlatRedBall or Custom Type** is selected.
4. Select **ShapeCollection**
5. Click **OK**<br>

   <figure><img src="/files/SnWqTJBMx43Gs9Q0fJQY" alt=""><figcaption><p>Add a ShapeCollection through the New Object window</p></figcaption></figure>

Note that FlatRedBall also supports the .shcx file format, but this is no longer recommended. The PolygonEditor tool is no longer maintained, and the recommended approach is to add a ShapeCollection as shown above and to modify the shapes using FlatRedBall's LiveEdit.

### Adding Shapes to a ShapeCollection in FlatRedBall

ShapeCollections can have shapes added manually. The ShapeCollection serves as a "list" of shapes, but unlike normal lists, the ShapeCollection can contain multiple types of objects.

To add a new shape to the ShapeCollection:

1. Right-click on the ShapeCollection instance
2. Select **Add Object**
3. Select one of the shapes - notice that FlatRedBall filters the available types to the types allowed in a ShapeCollection.<br>

   <figure><img src="/files/PBv4LftSWLXnr3z9CxJy" alt=""><figcaption></figcaption></figure>
4. Click OK

Your newly-created shape is added to ShapeCollection in the tree view.

<figure><img src="/files/V7hd8DycBtzftbx55x19" alt=""><figcaption><p>New AxisAlignedRectangle in ShapeCollection</p></figcaption></figure>

### ShapeCollection in code

For information on how to work with a ShapeCollection in code, see [the ShapeCollection page](https://github.com/flatredball/FlatRedBallDocs/blob/main/frb/docs/index.php).


---

# 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/objects/object-types/glue-reference-shapecollection.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.
