Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetCollisionEvents

Deprecated: Use the overload that takes a List. That overload doesn't create garbage.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.ParticleSystemModule

GetCollisionEvents(ParticleSystem, GameObject, ParticleCollisionEvent[])

Deprecated: Use the overload that takes a List. That overload doesn't create garbage.
Warning
Deprecated. GetCollisionEvents function using ParticleCollisionEvent[] is deprecated. Use List\<ParticleCollisionEvent\> instead.
public static int GetCollisionEvents(this ParticleSystem ps, GameObject go, ParticleCollisionEvent[] collisionEvents)

Parameters

Returns

Type

Description

int

GetCollisionEvents(ParticleSystem, GameObject, List<ParticleCollisionEvent>)

Get the particle collision events for a GameObject. Returns the number of events written to the array.
public static int GetCollisionEvents(this ParticleSystem ps, GameObject go, List<ParticleCollisionEvent> collisionEvents)

Parameters

The Particle System that owns the potentially colliding particles.

The GameObject for which to retrieve collision events.

Array to write collision events to.

Returns

Type

Description

intThe number of collision events.

Remarks

This method is typically called from OnParticleCollision in response to a collision callback.
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.
Additional Resources: OnParticleCollision