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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
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.