Search Issue Tracker
Fixed in 2020.2.X
Fixed in 2019.4.X, 2020.1.X
Votes
1
Found in
2019.3.8f1
2019.4
2019.4.3f1
2020.1
2020.2
Issue ID
1262936
Regression
Yes
Editor crashes on PhysicsContacts2D::EndContact when exiting Play mode after Assertion failed on expression: GetShape() == NULL
Reproduction steps:
1. Open the attached "case_1262936.zip" project
2. Load the "SampleScene" and enter Play mode
3. Click twice the "Test Crouching" button and observe errors in the Console window
4. Exit Play mode
-- Observe the crash
Reproduces on: 2019.3.8f1, 2019.3.4f3, 2020.1.0b16, 2020.2.0a18
Not reproducible with: 2019.3.7f1
Could not test with 2018.4 due to multiple compilation errors
Note: instead of clicking "TestCrouching" button you can manually uncheck and then check again the "IsCrouchingTest" variable found in "PlayerMovement_Long" Component in the Inspector window when the "Player" GameObject is selected in the Hierarchy window
First lines of the stack trace:
0x00007FF66C524D63 (Unity) PhysicsContacts2D::EndContact
0x00007FF66C4A4835 (Unity) b2ContactManager::Destroy
0x00007FF66C4A4B14 (Unity) b2World::DestroyBody
0x00007FF66C53DD9F (Unity) Rigidbody2D::Cleanup
0x00007FF66B238558 (Unity) GameObject::ActivateAwakeRecursivelyInternal
<...>
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
- Crash on mecanim::SetValueWeight when switching the AnimationMixerPlayable connection with Animator's UpdateMode set to "Animate Physics"
- The "StringComparer.InvariantCultureIgnoreCase.GetHashCode()" returns different Hash Codes for the same word with the only difference being case sensitivity in WebGL
- 2D Light Textures show the lights of any 'blend style' index higher than theirs (if present) when they aren't visible by the Camera using Render Graph
- [SpeedTree] Wireframe mode not rendering correctly ST assets
- Light2D affecting only the Default Sorting Layer will also affect any Custom Lit Sprite not on that Layer when using Render Graph
Resolution Note (fix version 2020.2):
The "Physics2D.callbacksOnDisable" feature when enabled allows recursive physics callbacks and modifying of collider state. With it off, in this case specifically, a reparenting action results in the collider be recreated therefore leaving orphaned collision shapes. When the collider is enabled again, an assert throws which verifies that no collision shapes are present prior to it being enabled.
Enabling this callback bypasses the issue however we have fixed the issue by ensuring that the enabled/disabled state of the component is actioned prior to any modifications to the 2D collider. This stops any side-effects of disabling/enabling from affecting the recursive call.
Resolution Note (fix version 2020.1):
The "Physics2D.callbacksOnDisable" feature when enabled allows recursive physics callbacks and modifying of collider state. With it off, in this case specifically, a reparenting action results in the collider be recreated therefore leaving orphaned collision shapes. When the collider is enabled again, an assert throws which verifies that no collision shapes are present prior to it being enabled.
Enabling this callback bypasses the issue however we have fixed the issue by ensuring that the enabled/disabled state of the component is actioned prior to any modifications to the 2D collider. This stops any side-effects of disabling/enabling from affecting the recursive call.
Resolution Note (fix version 2019.4):
The "Physics2D.callbacksOnDisable" feature when enabled allows recursive physics callbacks and modifying of collider state. With it off, in this case specifically, a reparenting action results in the collider be recreated therefore leaving orphaned collision shapes. When the collider is enabled again, an assert throws which verifies that no collision shapes are present prior to it being enabled.
Enabling this callback bypasses the issue however we have fixed the issue by ensuring that the enabled/disabled state of the component is actioned prior to any modifications to the 2D collider. This stops any side-effects of disabling/enabling from affecting the recursive call.