0
\$\begingroup\$

Problem is in the title.

The sword sprite is a child of body which is a child of my char. Sword and Char have collider and rigidbody, and if the char and enemy collide, it works. But it does not detect the collision between sword and enemy.

I have an own script on the sword which checks collision.

void OnCollisionEnter2D(Collider2D other)
{
    if (other.transform.tag == "enemy")
    {
        Destroy(other.gameObject);
    }
}

enter image description here

Dont know any further.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.