Two Collision 2D

I have two Colliders in my player (Box Collider 2D and CircleColllider2D). I wish to only be able to hit only one object that has a trigger set up. Since I have 2, the output from this code will always be 2 :(. Is there a way to only trigger my circle collider however the box collider wouldn’t be triggered? (Output would be + 1 instead of +2).

If the Colliders do not overlap, maybe you could put them each on an empty Gameobject, then make the Empty Gameobjects children for your player?

You would have a script on each “holder” object, and check for collisions from there.

Be sure to tag all the objects as the same thing, so you can use Project Settings → Physics to keep them from colliding on each other, if that is an issue.

You can ignore one collider everytime it hits something like this:

void OnCollisionEnter2D (Collision2D collision) {
        Physics2D.IgnoreCollision(yourCollider, collision);
}

Or you could make a variable which is set to true when one of the collider triggers, then check it if the other one would trigger.