文档

Unity Engine

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.
阅读时间1 分钟最后更新于 11 天前

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.