# 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](https://docs.flatredball.com/flatredball/glue-reference/entities/glue-reference-implements-icollidable) 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="https://951240982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fye9Ufg3vzJxwX5Hk%2Fuploads%2Fgit-blob-c59589b5ed1c684eda72b9dd1103e330c0966505%2Fmigrated_media-AddShapeCollectionObject.PNG?alt=media" 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="https://951240982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fye9Ufg3vzJxwX5Hk%2Fuploads%2FfwwwJTe8fLoEUBBjvYvx%2Fimage.png?alt=media&#x26;token=c0e96ca5-d1b8-4d77-a7f2-7edd8f02b353" alt=""><figcaption></figcaption></figure>
4. Click OK

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

<figure><img src="https://951240982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fye9Ufg3vzJxwX5Hk%2Fuploads%2FOT4ZgbU69vvJNlX3BIBI%2Fimage.png?alt=media&#x26;token=f7baf2f3-0386-4a52-a12b-26b14e894cac" 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).
