Search Issue Tracker
Fixed in 2018.2.X
Fixed in 2018.1.X
Votes
0
Found in
2017.2.0b5
2018.2.0a1
Issue ID
999627
Regression
Yes
[Physics2D] OnCollisionEnter2D Collision2D.contacts returns an empty array
A fast moving projectile that collides with a corner of two colliders returns an empty array of contacts in the OnCollisionEnter2D event.
To repro:
1) Open the "repro.unitypackage" and the scene "LiteralCornerCase".
2) Notice the setup - there are two box 2d colliders that form a corner and a bullet that is about to hit that corner at a high speed.
3) Enter play mode
4) Notice the "Got zero contacts!" log in the console, indicating the issue.
Removing either of the blocks that form the corner prevents this issue. Reducing the velocity of the bullet also prevents this issue.
The problem is in destroying the bullet inside the OnCollisionEnter2D event - this messes up any future contact checks. Since there are two blocks to be collided with, one gets the collision event and destroys the bullet. The other also gets the collision event, but the bullet has already been prepped for destruction, thus all contacts return 0.
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 mono_dump_native_crash_info when changing a Particle System Renderer’s Material Shader to Standard Unlit
- VFX Prefab doesn’t have Preview icon in Project window and Preview window is empty in Inspector window
- “RenderSettings customReflection texture has invalid type” error keeps getting thrown even when Environment Reflections was set back to Skybox from Custom with an invalid texture
- Particle System with the custom Material breaks the Scene view when the material is using a Shader Graph with the Texture with the power of negative value
- Invalid asset path & Invalid value for font MissingAssetReference Warnings are spammed when deleting a Font used by any Element in UI Builder
Add comment