# SetCallbackTarget(ReadOnlySpan<PhysicsJoint>, object)

> Set the same Object that event callbacks will be sent to on a batch of joints. Each joint is assigned the callback target as PhysicsJoint.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\<PhysicsJoint>, Object)

```csharp
public static int SetCallbackTarget(ReadOnlySpan<PhysicsJoint> joints, object callbackTarget)
```

### Parameters

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

### Returns

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

### Remarks

This is faster than setting [PhysicsJoint.callbackTarget](/engine/7000.0/script-reference/unity/u2d/physics/physicsjoint/callbacktarget.md) on each joint.
