2D Collider Problem

This line of code keeps getting called after I had changed my players 2Dcollider from the circle to a box with the exact same settings. This means after a few seconds the player just dies. I will provide the code getting called repeatedly and a screenshot of the box collider settings.

void OnTriggerEnter2D(Collider2D other)
    {
        if (timer >= timeBetweenAttacks && playerHealth.currentHealth > 0)
            {
                Attack();
            }    
    }

80154-box-colliders-player.png

i donĀ“t know how your game looks like, but maybe the problem is that you do not ask which collider enters your trigger. Without a check that usually looks like the following example every single gameObject with a 2D-Collider that comes in contact with the gameobject that has this script attached will trigger this Attack()-function.

    void OnTriggerEnter2D(Collider2D other)
    {
        if(other.gameObject.tag == "myTag")
        {
            // your code here
        }
    }