Multiple Colliders On A Single Object Detecting Each Collider In OnTriggerEnter()


I have somewhat complex characters in a game I am working on. (They are dinosaurs so they range from bipeds to quadrupeds both with and without tails). I require multiple colliders on my characters. The first one is a mesh collider, simply a convex mesh that acts as the main collision detection. The other is a box collider, this is so that the characters cannot walk on top of each other.

This being said, I then have a OnTriggerEnter() function that detects if I hit a enemy (using collider.transform.root.compareTag()) And then damages that enemy. However, having two colliders, this fires twice instead of once. Any solution to this problem? I am aware that I could detect if I have alerady hit that gameobject once and if I have just ignore it on the second collision. This would then require me to store both colliders in a list and once in exits both colliders reset the list, which just feels a bit hacky to me, and I would imagine there is some practice to doing this properly?

Thank you in advance

Wouldn’t it be intuitive for an intruder to cooldown before attacking again?

Otherwise you can also set Unity to ignore certain colliders (after layers). Then I would set the attacker to ignore the box collider. The attacker won’t climb onto the dinosaur anyway? and if he does, I would actually find it pretty cool