# SetSelectedDrawing(ReadOnlySpan<PhysicsBody>, bool)

> Set the selected drawing state on a batch of bodies.

## Definition

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

```csharp
public static int SetSelectedDrawing(ReadOnlySpan<PhysicsBody> bodies, bool selected)
```

### Parameters

**** (\[ReadOnlySpan\<PhysicsBody>]\(https\://learn.microsoft.com/dotnet/api/system.readonlyspan-1)): The bodies to set the selected drawing state on.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): The selected drawing state to set on every body.

### Returns

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

### Remarks

The bodies can belong to different worlds; the world of each body is locked only when it changes across the batch, so bodies should be ordered by world for the fewest locks. Any invalid body in the batch is ignored. See [\_selectedDrawing](/engine/6000.7/script-reference/unity/u2d/physics/physicsbody/selecteddrawing.md) for what the state controls.
