# CanContact(Collider2D)

> This method determines if both Colliders can ever come into contact.

## Definition

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

```csharp
public bool CanContact(Collider2D collider)
```

### Parameters

**** (\[Collider2D]\(/engine/6000.7/script-reference/unityengine/collider2d)): The other Collider that is to be checked to see if it can contact the current Collider.

### Returns

| Type                                                          | Description                                                                                                               |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Returns `true` if both Colliders can contact each other otherwise `false` indicating that they cannot contact each other. |

### Remarks

Determining if Colliders can come into contact involves multiple checks including:

* Each [Collider2D](/engine/6000.7/script-reference/unityengine/collider2d.md) must be active and enabled. See [\_isActiveAndEnabled](/engine/6000.7/script-reference/unityengine/behaviour/isactiveandenabled.md).

* Each [Collider2D](/engine/6000.7/script-reference/unityengine/collider2d.md) must be on a [GameObject](/engine/6000.7/script-reference/unityengine/gameobject.md) that is in the same [PhysicsScene2D](/engine/6000.7/script-reference/unityengine/physicsscene2d.md). By default, this is true but see [PhysicsSceneExtensions2D.GetPhysicsScene2D](/engine/6000.7/script-reference/unityengine/physicssceneextensions2d/getphysicsscene2d.md) and [LocalPhysicsMode.Physics2D](/engine/6000.7/script-reference/unityengine/scenemanagement/localphysicsmode/physics2d.md).

* Each [Collider2D](/engine/6000.7/script-reference/unityengine/collider2d.md) that is attached to a Rigidbody2D must have a compatible [\_bodyType](/engine/6000.7/script-reference/unityengine/rigidbody2d/bodytype.md). For instance [RigidbodyType2D.Static](/engine/6000.7/script-reference/unityengine/rigidbodytype2d/static.md) cannot contact another [RigidbodyType2D.Static](/engine/6000.7/script-reference/unityengine/rigidbodytype2d/static.md). Without a [Rigidbody2D](/engine/6000.7/script-reference/unityengine/rigidbody2d.md), the [Collider2D](/engine/6000.7/script-reference/unityengine/collider2d.md) is implicitly Static. Kinematic vs Kinematic/Static will only contact if [\_useFullKinematicContacts](/engine/6000.7/script-reference/unityengine/rigidbody2d/usefullkinematiccontacts.md) is enabled.

* The [Collider2D](/engine/6000.7/script-reference/unityengine/collider2d.md) will not contact if they are specified using [Physics2D.IgnoreCollision](/engine/6000.7/script-reference/unityengine/physics2d/ignorecollision.md).

* The [Collider2D](/engine/6000.7/script-reference/unityengine/collider2d.md) will not contact if they are part of an [Effector2D](/engine/6000.7/script-reference/unityengine/effector2d.md) that is using [\_useColliderMask](/engine/6000.7/script-reference/unityengine/effector2d/usecollidermask.md).

* The [Collider2D](/engine/6000.7/script-reference/unityengine/collider2d.md) will not contact if their layer collision (in the Layer Collision Matrix) is set to not contact unless overriden using the [Rigidbody2D](/engine/6000.7/script-reference/unityengine/rigidbody2d.md) and [Collider2D](/engine/6000.7/script-reference/unityengine/collider2d.md) layer overrides.

Additional Resources: [\_contactMask](/engine/6000.7/script-reference/unityengine/collider2d/contactmask.md), [\_includeLayers](/engine/6000.7/script-reference/unityengine/collider2d/includelayers.md), [\_excludeLayers](/engine/6000.7/script-reference/unityengine/collider2d/excludelayers.md), [\_includeLayers](/engine/6000.7/script-reference/unityengine/rigidbody2d/includelayers.md), [\_excludeLayers](/engine/6000.7/script-reference/unityengine/rigidbody2d/excludelayers.md)
