UnityRef is currently in early development. Some features may be incomplete and/or not functioning.

UNITYREF

Your Pit Stop For Solving ANYTHING in Unity

physics

[Rigidbody2D] Kinematic Collisions Fail: OnCollisionEnter2D Not Triggering

Under Audit

rigidbodyphysicsar development

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.

Issue

 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.

Experimental Fixes
  • Ensure the Collision Detection Mode of the Kinematic Rigidbody2D is set to Continuous or Continuous Dynamic if objects are moving at high speeds.
  • Verify that the Layer Collision Matrix within Project Settings > Physics 2D is configured to allow interactions between the layers of both colliding objects.
  • Confirm that OnCollisionEnter2D is correctly implemented as a public method and exists on a script attached to an object with an active Collider2D and Rigidbody2D.

Editor's Note:

The above fixes have not been verified by our audit team yet. They are provided exclusively for your own technical research. We recommend creating a backup of your project before proceeding with any attempts. Utilize at your own discretion!

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.