1 void OnCollisionEnter(Collision collision)
2 {
3 if (collision.gameObject.tag == "theobjectToIgnore")
4 {
5 Physics.IgnoreCollision(theobjectToIgnore.collider, collider);
6 }
7
8
1Create a new layer called "Enemies" and have it
2be the layer of all your enemy gameobjects. Then
3take a look at the Physics Layers settings under
4Edit/Project Settings/Physics,
5and disable collisions for objects
6in the Enemies layer with other
7objects in that same layer.