기술 자료

Unity Engine

Unity Engine

SetCallbackTarget(ReadOnlySpan<PhysicsBody>, object)

Set the same Object that event callbacks will be sent to on a batch of bodies. Each body is assigned the callback target as PhysicsBody.callbackTarget would, and setting it to NULL removes it.
읽는 시간 1분최근 업데이트: 12일 전

Definition

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

SetCallbackTarget(ReadOnlySpan<PhysicsBody>, Object)

public static int SetCallbackTarget(ReadOnlySpan<PhysicsBody> bodies, object callbackTarget)

Parameters

The bodies to set the callback target on.

callbackTarget

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

Returns

Type

Description

intThe number of bodies that were ignored (not set because the body was invalid). A single warning is logged when any are ignored.

Remarks

This is faster than setting PhysicsBody.callbackTarget on each body.