Thanks to Jadon Wolfgang I have been able to figure out why my code wasn’t working. So the problem was that I was comparing Box Colliders and not collisions, so to fix this problem I found that you can use a function called IsTouching()

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "ThePlayer")
        {
            if (DamageTriggers[0].IsTouching(collision))
            {
                LeftClawAttack();
            }
            else if (DamageTriggers[1].IsTouching(collision))
            {
                RightClawAttack();
            }
            else
            {
                Debug.Log("False");
            }
        }
    }

Here is the new code if anyone else was having a similar problem.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top