# GetCollisionEvents

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

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.6/script-reference/unityengine.md)
* **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.

```csharp
public static int GetCollisionEvents(this ParticleSystem ps, GameObject go, ParticleCollisionEvent[] collisionEvents)
```

### Parameters

**** (\[ParticleSystem]\(/engine/6000.6/script-reference/unityengine/particlesystem)): **** (\[GameObject]\(/engine/6000.6/script-reference/unityengine/gameobject)): **** (\[ParticleCollisionEvent\[]]\(/engine/6000.6/script-reference/unityengine/particlecollisionevent)):&#x20;

### Returns

| Type                                                       | Description |
| ---------------------------------------------------------- | ----------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) |             |

## GetCollisionEvents(ParticleSystem, GameObject, List\<ParticleCollisionEvent>)

Get the particle collision events for a GameObject. Returns the number of events written to the array.

```csharp
public static int GetCollisionEvents(this ParticleSystem ps, GameObject go, List<ParticleCollisionEvent> collisionEvents)
```

### Parameters

**** (\[ParticleSystem]\(/engine/6000.6/script-reference/unityengine/particlesystem)): The Particle System that owns the potentially colliding particles.**** (\[GameObject]\(/engine/6000.6/script-reference/unityengine/gameobject)): The GameObject for which to retrieve collision events.**** (\[List\<ParticleCollisionEvent>]\(https\://learn.microsoft.com/dotnet/api/system.collections.generic.list-1)): Array to write collision events to.

### Returns

| Type                                                       | Description                     |
| ---------------------------------------------------------- | ------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The number of collision events. |

### Remarks

This method is typically called from [MonoBehaviour.OnParticleCollision(GameObject)](/engine/6000.6/script-reference/unityengine/monobehaviour/onparticlecollision.md) 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](/engine/6000.6/script-reference/unityengine/particlephysicsextensions/getsafecollisioneventsize.md) to determine an appropriate array size prior the call.

Additional Resources: [MonoBehaviour.OnParticleCollision(GameObject)](/engine/6000.6/script-reference/unityengine/monobehaviour/onparticlecollision.md).
