How to set only one collider with OnCollisionEnter(Collision col) in Unity?

I tried with this:

void OnCollisionEnter(Collision col)
{
Debug.Log("hit everything");
{
if (col.gameObject.tag == "Floor")
{
Debug.Log("hit");
Destroy(gameObject);
ShipHealth ShipHealth = this.GetComponentInParent<ShipHealth>();
if (ShipHealth != null)
{
Destroy(gameObject);
ShipHealth.TakeDamageMissile(100);
}
}
}
}


What I want is that it only chooses one collider and not all: I only want the capsule collider.

• Its not clear what you want. Do you want to destroy the capsule collider when it hits the floor? Where is the code you provided running? On the whole ship or just the capsule collider objcet ? – Uri Popov May 30 '16 at 11:31