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
- WebGL build dependencies are not refreshed until the Editor is restarted
- “Audio Random Container” allows adding unlimited number in “Audio Clips” numeric field, causing Editor to freeze
- In Deferred rendering path, mixed lights don't render when enabling "Use Rendering Layers" in the Decal renderer feature
- [Windows] Special characters in file names are sorted to the end of the alphabet in the Project window
- Information box icons are not contained within the information box bounds in Render Pipeline Converter window
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.