Search Issue Tracker

Not Reproducible

Votes

1

Found in

5.6.2p4

Issue ID

935160

Regression

No

Disabling a parent GameObject that has many children with Rigidbody component is very slow

Physics

-

The issue happens only when the children of the object that is being disabled have a Rigidbody on them. The lag spike reaches up to 120ms. When disabling the children directly, lag spike is ~16ms, but still way more than when the objects have no Rigidbody component

To reproduce:

1. Open the project, attached by the tester (disableLag.zip)
2. Open the "scene" scene
3. Open the Profiler
4. Enter Play mode
5. While focused on Game view, press Space to disable objects
6. Observe the blue spike that appears in the Profiler

Expected: disabling an object with children who have Rigidbody components on them doesn't cause enormous lag spikes

Reproduced in 5.4.5p4, 5.5.4p2, 5.6.2p4, 5.6.3f1, 2017.1.0p2, 2017.2.0b5, 2017.3.0a2
Not reproducible with: 2021.1.0a2

  1. Resolution Note:

    The side problem of deactivation being expensive relates to all the cubes being at the same spot, and even though they have disabled collision detection by the means of layering - physx would still keep an entry per each overlapping pair because pairwise ignorance is defined not in physx but in unity code. In a real project, I'd suggest making sure the bodies are far away and use ABP broadphase to make sure excess pairs aren't created in the first place.

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.