OnCollisionEnter is not called in unity with 2D colliders

Viewed 30791

I checked nearly every answer for this, but those were mostly simple errors and mistakes. My problem is that OnCollisionEnter is not called even when colliding whith other rigidbody.

here is the part what does not get called:

 void OnCollisionEnter(UnityEngine.Collision col) {
        Debug.Log("collision!!!");
        foreach(ContactPoint contact in col.contacts) {
            //checking the individual collisions
            if(contact.Equals(this.target))
            {
                if(!attacking) {
                    Debug.Log("hitting target");
                } else {
                    Debug.Log("dying");
                    //engage death sequence
                }
            }
        }
    }

Not even the "collision!!!" message appears. Do I understand the usage wrong, or did I forget something?

6 Answers
Related