Search Issue Tracker
By Design
Votes
5
Found in
4.3.0b6
Issue ID
570326
Regression
No
OnCollisionExit2D doesn't work
To reproduce:
1. Open my attached project
2. Run the scene
3. Move the game object with arrow keys
4. Observe that there are no log messages when the object drops down from a platform
--------------------
Why is it by design?
When you adjust the position, rotation, scale or parent directly you are warping the object through space which the physics system doesn't support. When you do any of these operations then you will not get the resultant "end" calls and cause other side-effects.
If you output something in "OnCollisionEnter2D" you will see it is continually entering the collision because you are effectively repositioning the object in the enter callback. You should not do this.
You are adding a force rather than setting the position directly for this very reason.
Adjusting the parent in the collision callbacks is the problem and all transform related operations should be avoided when physics objects are involved.
Comments (3)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- var VisionOSEDRHeadromm has a comma instead of a dot when building with Metal Rendering App Mode and local OS localization is set to German
- IAP Catalog remove product “x” and add product “+” buttons are not consistent with other remove and add buttons in the Editor
- Performance issues in Play Mode when quickly hovering the mouse cursor over Hierarchy GameObjects
- Frame Debugger displays incorrect output when FidelityFX Super Resolution or Spatial-Temporal Upscaler is used with Temporal Anti-aliasing or Subpixel Morphological Anti-aliasing
- Crash with “Fatal Error! The file ‘MemoryStream’ is corrupted!” when adding a large number in Font Character Rects Size field
twoski
Apr 03, 2014 15:14
The same occurs for me. I have a rigid body with a collider and it only seems to call the exit function once and never again.
WhyCantIUseMyLogin
Dec 07, 2013 13:10
I also echo this problem… I have Rigidbody2d that generate an OnCollisionEnter2D, but no OnCollisionExit2D event.