# GetContactColliders

> Retrieves all colliders in contact with this Collider, with the results filtered by the contactFilter.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.Physics2DModule

## GetContactColliders(Collider2D, ContactFilter2D, Allocator)

Retrieves all colliders in contact with this Collider, with the results filtered by the `contactFilter`.

```csharp
public static ColliderArray2D GetContactColliders(Collider2D collider, ContactFilter2D contactFilter, Allocator allocator = Allocator.Temp)
```

### Parameters

**** (\[Collider2D]\(/engine/6000.7/script-reference/unityengine/collider2d)): The Collider to retrieve contacts for.**** (\[ContactFilter2D]\(/engine/6000.7/script-reference/unityengine/contactfilter2d)): The contact filter used to filter the results differently, such as by layer mask, Z depth, or normal angle.**** (\[Allocator]\(/engine/6000.7/script-reference/unity/collections/allocator)): The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.

### Returns

| Type                                                                              | Description                                                                                                                     |
| --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| [ColliderArray2D](/engine/6000.7/script-reference/unityengine/colliderarray2d.md) | A collection of Collider2D containing the results. The collection does not allocate any managed memory but must be disposed of. |

## GetContactColliders(Rigidbody2D, ContactFilter2D, Allocator)

Retrieves all colliders in contact with this Rigidbody, with the results filtered by the `contactFilter`.

```csharp
public static ColliderArray2D GetContactColliders(Rigidbody2D rigidbody, ContactFilter2D contactFilter, Allocator allocator = Allocator.Temp)
```

### Parameters

**** (\[Rigidbody2D]\(/engine/6000.7/script-reference/unityengine/rigidbody2d)): The Rigidbody to retrieve contacts for.  All Colliders attached to this Rigidbody will be checked.**** (\[ContactFilter2D]\(/engine/6000.7/script-reference/unityengine/contactfilter2d)): The contact filter used to filter the results differently, such as by layer mask, Z depth, or normal angle.**** (\[Allocator]\(/engine/6000.7/script-reference/unity/collections/allocator)): The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.

### Returns

| Type                                                                              | Description                                                                                                                     |
| --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| [ColliderArray2D](/engine/6000.7/script-reference/unityengine/colliderarray2d.md) | A collection of Collider2D containing the results. The collection does not allocate any managed memory but must be disposed of. |
