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.
Read time 1 minuteLast updated 2 days ago
Definition
- Type: Method
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
SetCallbackTarget(ReadOnlySpan<PhysicsJoint>, Object)
public static int SetCallbackTarget(ReadOnlySpan<PhysicsJoint> joints, object callbackTarget)
Parameters
The joints to set the callback target on.
The callback target to set on every joint, or NULL to remove it.
Returns
Type | Description |
|---|---|
| int | 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 on each joint.