# IgnoreCollision(Collider, Collider, bool)

> Makes the collision detection system ignore all collisions between collider1 and collider2.

## Definition

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

```csharp
public static void IgnoreCollision(Collider collider1, Collider collider2, bool ignore)
```

### Parameters

**** (\[Collider]\(/engine/6000.6/script-reference/unityengine/collider)): Any collider.**** (\[Collider]\(/engine/6000.6/script-reference/unityengine/collider)): Another collider you want to have `collider1` to start or stop ignoring collisions with.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Whether or not the collisions between the two colliders should be ignored or not.

### Remarks

This is useful, say, for preventing projectiles from colliding with the object that fires them.

Note that [Physics.IgnoreCollision](/engine/6000.6/script-reference/unityengine/physics/ignorecollision.md) is not persistent. This means ignore collision state will not be stored in the editor when saving a scene.

If `ignore` is false, collisions can occur. Set `ignore` to true to ignore collisions.

Additional Resources: [Physics.IgnoreLayerCollision](/engine/6000.6/script-reference/unityengine/physics/ignorelayercollision.md).

### Examples

```csharp
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour
{
    public Transform bulletPrefab;

    void Start()
    {
        Transform bullet = Instantiate(bulletPrefab) as Transform;
        Physics.IgnoreCollision(bullet.GetComponent<Collider>(), GetComponent<Collider>());
    }
}
```
