sensing the tag of a colider

hi. Im making a fighter pilot game. i want to reset the level when the plane collides with certain game ojects but not others. basicly im looking for a code which says: when controler colides with game object than if game object is taged “some tag” than reset level. any code would be appreciated. thanks.:slight_smile:

You can access the gameobject’s tag through the collision info passed in the OnCollisionEnter function:

C# code:

void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.tag != "some_tag")
        {
            // Do something
        }
    }