# SetCallbackTarget(ReadOnlySpan<PhysicsShape>, object)

> Set the same Object that callbacks will be sent to on a batch of shapes. Each shape is assigned the callback target as PhysicsShape.callbackTarget would, and setting it to NULL removes it.

## Definition

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

## SetCallbackTarget(ReadOnlySpan\<PhysicsShape>, Object)

```csharp
public static int SetCallbackTarget(ReadOnlySpan<PhysicsShape> shapes, object callbackTarget)
```

### Parameters

**** (\[ReadOnlySpan\<PhysicsShape>]\(https\://learn.microsoft.com/dotnet/api/system.readonlyspan-1)): The shapes to set the callback target on.**** (\[Object]\(https\://learn.microsoft.com/dotnet/api/system.object)): The callback target to set on every shape, or NULL to remove it.

### 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.callbackTarget](/engine/7000.0/script-reference/unity/u2d/physics/physicsshape/callbacktarget.md) on each shape.
