Version: 2022.3
public static int GetCollisionEvents (ParticleSystem ps, GameObject go, List<ParticleCollisionEvent> collisionEvents);

参数

go 对其检索碰撞事件的 GameObject。
collisionEvents 要将碰撞事件写入到其中的数组。
ps The Particle System that owns the potentially colliding particles.

返回

int The number of collision events.

描述

获取 GameObject 的粒子碰撞事件。返回写入数组的事件数。

此方法通常从 MonoBehaviour.OnParticleCollision 调用,以响应碰撞回调。

If the array used is too short, the list of collision events will be truncated. This means you will not have every event that occurred. To avoid this use ParticlePhysicsExtensions.GetSafeCollisionEventSize to determine an appropriate array size prior the call.

另请参阅:MonoBehaviour.OnParticleCollision


Obsolete public static int GetCollisionEvents (ParticleSystem ps, GameObject go, ParticleCollisionEvent[] collisionEvents);

描述

Deprecated: Use the overload that takes a List. That overload doesn't create garbage.