How to make different things happen when you collide with something in unity code example
Example: how to make colliders collide with some things but not other in unity
//ignores all collisions between the object collided with and the
//gameobject that this script is attached to
Physics.IgnoreCollision(
collision.gameObject.GetComponent<SphereCollider>(),
gameObject.GetComponent<SphereCollider>());