Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


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.
Read time 1 minuteLast updated a day ago

Definition

  • Type: Method
  • Namespace: Unity.U2D.Physics
  • Assembly: UnityEngine.PhysicsCore2DModule

SetCallbackTarget(ReadOnlySpan<PhysicsShape>, Object)

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

Parameters

The shapes to set the callback target on.

callbackTarget

The callback target to set on every shape, or NULL to remove it.

Returns

Type

Description

intThe 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 on each shape.