OnTriggerExit not working when trigger disabled

I currently have two fighters, neither of which can move while fighting. I have a bool called isFighting that is activated by OnTriggerEnter when the fighters collide. They both have kinematic rigidbodies and the colliders act as triggers.

When one fighter dies, I disable that GameObject. I want the surviving fighter to stop taking damage, since the first fighter is dead, and I try to do that through OnTriggerExit. However, when the first fighter is deactivated, the second doesn’t run OnTriggerExit.

Does anyone know why this might be? I saw some other posts but none that dealt with an activated gameobject calling OnTriggerExit.

I assume this is because disabling an object removes it from the physics system completely instead of gracefully emulating an “I am leaving my current collisions” for the object.

You could always check if the suggestion board has a suggestion for adding this as a feature, and upvote that. Alternatively add the suggestion to do a graceful emulation of collision/trigger exits on disabled gameobjects.

My suggestion would be to manually call your equivalent of “StopTakingDamage()” on the surviving fighter by code. I would put this code next to your equivalent of “DisableDeadFighter()”. Something like this:

public void FighterIsDead(GameObject theDeadFighter){
    theDeadFighter.SetActive(false);

    // I assume you can somehow get a ref to the surviving fighters gameobject/transform
    theSurvivingFighter.GetComponent<TakingDamageScript>().StopTakingDamage();
}