# SetBatchDefinition(ReadOnlySpan<PhysicsShape>, PhysicsShapeDefinition)

> Set the same shape definition on a batch of shapes by writing all of its properties to each shape, as PhysicsShape.definition would.

## Definition

* **Type:** Method
* **Namespace:** [Unity.U2D.Physics](/engine/6000.7/script-reference/unity/u2d/physics.md)
* **Assembly:** UnityEngine.PhysicsCore2DModule

```csharp
public static int SetBatchDefinition(ReadOnlySpan<PhysicsShape> shapes, PhysicsShapeDefinition definition)
```

### Parameters

**** (\[ReadOnlySpan\<PhysicsShape>]\(https\://learn.microsoft.com/dotnet/api/system.readonlyspan-1)): The shapes to set the definition on.**** (\[PhysicsShapeDefinition]\(/engine/6000.7/script-reference/unity/u2d/physics/physicsshapedefinition)): The definition to set on every shape.

### Returns

| Type                                                       | Description                                                                                                                      |
| ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The number of shapes that were ignored (not set because the shape was invalid). A single warning is logged when any are ignored. |

### Remarks

This is faster than setting [PhysicsShape.definition](/engine/6000.7/script-reference/unity/u2d/physics/physicsshape/definition.md) on each shape. Writing every property is slower than setting only the properties you need, so this is best kept out of per-frame code. See [PhysicsShape.definition](/engine/6000.7/script-reference/unity/u2d/physics/physicsshape/definition.md).
