Physics.IgnoreCollision
static function IgnoreCollision(collider1: Collider, collider2: Collider, ignore: bool = true): void;
static void IgnoreCollision(Collider collider1, Collider collider2, bool ignore = true);
static def IgnoreCollision(collider1 as Collider, collider2 as Collider, ignore as bool = true) as void
Description

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

This is most useful for making eg. projectiles not collide with the object shooting them.

IgnoreCollision has a few limitations: 1) It is not persistent. This means ignore collision state will not be stored in the editor when saving a scene. 2) You can only apply the ignore collision to colliders in active game objects. When deactivating the collider or attached rigidbody the IgnoreCollision state will be lost and you have to call Physics.IgnoreCollision again. See Also: Physics.IgnoreLayerCollision.
	// Instantiate a bullet and make it ignore collisions with this object.

var bulletPrefab : Transform; function Start () { var bullet = Instantiate(bulletPrefab) as Transform; Physics.IgnoreCollision(bullet.collider, collider); }
using UnityEngine;
using System.Collections;

public class Example : MonoBehaviour {
    public Transform bulletPrefab;
    void Start() {
        Transform bullet = Instantiate(bulletPrefab) as Transform;
        Physics.IgnoreCollision(bullet.collider, collider);
    }
}
import UnityEngine
import System.Collections

public class Example(MonoBehaviour):

	public bulletPrefab as Transform

	def Start() as void:
		bullet as Transform = (Instantiate(bulletPrefab) as Transform)
		Physics.IgnoreCollision(bullet.collider, collider)