Search Issue Tracker

Fixed in 2022.2.X

Fixed in 2020.3.X, 2021.2.X, 2022.1.X

Votes

0

Found in

2020.3.20f1

Issue ID

1384863

Regression

No

Physics2D.DestroyShapes() has an enormous impact on performances even when very few Physics Shapes Exist

Physics2D

-

Reproduction steps:

1. Load the attached "TheBibitesDev.zip" project and download the attached "Broken.bb8settings" file.
2. Open the profiler.
3. Hit Play and Click on the Load Simulation Settings (occasionally you cannot click on it so pause/unpause the Editor and try again) and load the "Broken.bb8settings" file.
4. Click on the "Start" button (bottom right).
5. You must wait for a long time (approx 1 minute) for the project to initialize. Ensure the Status panel is on so you can watch the FPS. When it starts updating again then the test has begun.
6. Observe that over 30 seconds to a minute, the FPS will degrade down to a few FPS.
7. Alternately, spin-up the profiler and watch the time "Physics2D.DestroyShapes()" takes getting larger.

Expected result: There will be a gradual reduction however it won't be too severe.
Actual result: There is a sharp drop off in performance as the collider recreated load increases.

NOTE: The scripts shouldn't be doing continual rescaling and due to AutoSyncTransforms being used each query can cause this too so this is a bad code-path to be taking however, the performance impact of it should be improved.

  1. Resolution Note (fix version 2022.2):

    The issue here wasn't the actual recreation of the physics shapes but iterating contacts flagging them that they'll be recreated. This has been made much more efficient.
    Improvements available in Unity 2022.2.0a3 and above

  2. Resolution Note (fix version 2022.1):

    The issue here wasn't the actual recreation of the physics shapes but iterating contacts flagging them that they'll be recreated. This has been made much more efficient.
    Backport fix available on Unity 2022.1.0b5 and above

  3. Resolution Note (fix version 2021.2):

    The issue here wasn't the actual recreation of the physics shapes but iterating contacts flagging them that they'll be recreated. This has been made much more efficient.

  4. Resolution Note (fix version 2020.3):

    The issue here wasn't the actual recreation of the physics shapes but iterating contacts flagging them that they'll be recreated. This has been made much more efficient.
    Backport fix is available on Unity 2020.3.27f1 and above

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.