A child component is triggering its parent collider.

Hi guys, I just created a box collider, marked it as a trigger, and attached it to an enemy. Now I can use it as a sensor to check if the player is inside the skeleton attack range. Everything working fine here.

The problem comes when the player attacks back. I use the same logic in the other side, a player with a box collider attached used as attack. But this attack collides with the skeleton sensor, so it triggers the getDamage() rutine in the enemy.

Is there a way to fix this, or am I aproaching this problem the wrong way?
Thanks in advance!

do you mean that skeleton can attack box collider of player?

if it’s true.Add a tag in body collider of player(or skeleton).

    void OnTriggerEnter(Collider other) {
                //Damage code