Make object react to certain triggers only

Hi, I have a scene with two different triggers attached to box colliders, one changes the gravity force and the other changes the angular drag of the player.

The problem is, when I hit any of the triggers, it changes both the gravity and the drag.

How in code do I get it to differentiate between the triggers? I thought I was by naming the box colliders and calling them in the script like below, but that doesn’t seem to work.

    function OnTriggerEnter (DZone : Collider) {
        rigidbody.angularDrag = 0.4f;
        print("DRAG LOW DRAG LOW");
    }
    
    function OnTriggerExit (DZone : Collider) {
        rigidbody.angularDrag = 25.0f;
        print("DRAG HIGH DRAG HIGH");
    }

Any help would be appreciated.

Thanks!

You should compare the tags in order to differentiate between them.

    function OnTriggerEnter (DZone : Collider){
        if(DZone.tag == "TagOfObjectYouWantToReduceDragOF"){
           rigidbody.angularDrag = 0.4f;
           print("DRAG LOW DRAG LOW");
        }
    }
     
    function OnTriggerExit (DZone : Collider) {
        if(DZone.tag == "TagOfObjectYouWantToIncreaseDragOF"){
           rigidbody.angularDrag = 25.0f;
           print("DRAG HIGH DRAG HIGH");
        }
    }