# GetShape(int)

> Gets the PhysicsShape2D stored at the specified shapeIndex.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.Physics2DModule

```csharp
public PhysicsShape2D GetShape(int shapeIndex)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The index of the shape stored the [PhysicsShapeGroup2D](/engine/6000.7/script-reference/unityengine/physicsshapegroup2d.md). The shape index is zero-based with the shape group having a quantity of shapes specified by [shapeCount](/engine/6000.7/script-reference/unityengine/physicsshapegroup2d/shapecount.md).

### Returns

| Type                                                                            | Description                                             |
| ------------------------------------------------------------------------------- | ------------------------------------------------------- |
| [PhysicsShape2D](/engine/6000.7/script-reference/unityengine/physicsshape2d.md) | Returns the shape stored at the specified `shapeIndex`. |

### Remarks

**NOTE**: Because the [PhysicsShape2D](/engine/6000.7/script-reference/unityengine/physicsshape2d.md) is a struct, this is a copy of the shape therefore changing the shape afterwards will not change the [PhysicsShapeGroup2D](/engine/6000.7/script-reference/unityengine/physicsshapegroup2d.md).

### Examples

```csharp
using UnityEngine;
using UnityEngine.Assertions;

public class Example : MonoBehaviour
{
    void Start()
    {
        // Create a shape group.
        var shapeGroup = new PhysicsShapeGroup2D();

        // Add a Circle to the shape group.
        var circleShapeIndex = shapeGroup.AddCircle
            (
                center: new Vector2(-2f, 3f),
                radius: 1f
            );

        // Add a Capsule to the shape group.
        var capsuleShapeIndex = shapeGroup.AddCapsule
            (
                vertex0: Vector2.down,
                vertex1: Vector2.up,
                radius: 0.5f
            );

        // Validate the contents.
        Assert.AreEqual(PhysicsShapeType2D.Circle, shapeGroup.GetShape(circleShapeIndex).shapeType);
        Assert.AreEqual(PhysicsShapeType2D.Capsule, shapeGroup.GetShape(capsuleShapeIndex).shapeType);
    }
}
```
