[Rigidbody2D] Kinematic Collisions Fail: OnCollisionEnter2D Not Triggering
Under Audit
Unity 2021.3.x - Unity 6.0.x
Published 28 days ago
An issue where OnCollisionEnter2D callbacks are not triggered between a Kinematic Rigidbody2D and a Static Rigidbody2D, despite both having Collider2D components, being enabled, and showing visual contact.
When attempting to detect collisions between two objects, one configured with a Kinematic Rigidbody2D and the other with a Static Rigidbody2D, the OnCollisionEnter2D callback may not be invoked. Both objects are enabled, have Box Collider 2D components (not set as triggers), and are confirmed to be overlapping and on the same Z plane. Despite 'Enable All Contacts Pairs' being active in the Physics Settings and visual debuggers indicating contact between their colliders, scripts attached to both objects fail to register the collision, leading to no console output or breakpoint hits in a connected debugger.
- Ensure the Collision Detection Mode of the Kinematic
Rigidbody2Dis set toContinuousorContinuous Dynamicif objects are moving at high speeds. - Verify that the Layer Collision Matrix within
Project Settings>Physics 2Dis configured to allow interactions between the layers of both colliding objects. - Confirm that
OnCollisionEnter2Dis correctly implemented as apublicmethod and exists on a script attached to an object with an activeCollider2DandRigidbody2D.
Editor's Note:
Related Posts Haven't quite found a solution to your problem? We think these posts might help you.
Content inspired by a Unity discussion post.