Search Issue Tracker
Fixed
Fixed in 6000.0.38f1, 6000.1.0b6, 6000.2.0a3
Votes
0
Found in
6000.0.31f1
6000.1.0a8
6000.2.0a1
Issue ID
UUM-91011
Regression
Yes
Bad performance when executing the Physics.IgnoreCollisions() method while in Play Mode
Reproduction steps:
1. Open the attached “repro_IN-90839“ project
2. Open “Assets/OutdoorsScene.unity“ Scene
3. Open the Profiler (“Window → Analysis → Profiler“)
4. In the Profiler window, enable the “Record profiling information“, enable “Clear on Play“ and enable “Deep Profile“
5. Enter the Play Mode
6. In the Game view, select “Ignore(false)“ and then “Ignore(true)“
7. Exit or pause the Play Mode
8. In the Profiler window, in the “Hierarchy” section, find and select the “Physics.IgnoreCollision()“ method
9. Check the performance cost of it
Expected result: “Physics.IgnoreCollision()“, on both the “Ignore(false)“ and the “Ignore(true)“ button press spikes, shows up to 50 ms in the “Time ms“ column
Actual result: “Physics.IgnoreCollision()“ on the “Ignore(false)“ button press spike shows around 170 ms in the “Time ms“ column while the “Ignore(true)“ button press spike shows around 400-600 ms
Reproducible with: 2023.3.0b7, 6000.0.31f1, 6000.1.0a8
Not reproducible with: 2021.3.47f1, 2022.3.55f1, 2023.3.0b6
Reproducible on: Windows 10 (22H2), Windows 11 (24H2) (reporter’s environment)
Not reproducible on: No other environments tested
Note: Not able to test it in the Player
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
- Shader Graph Asset icon is not shown on creation unless you confirm the name
- APV Sky occlusion doesn't consider the terrain
- [iOS] "EXC_BAD_ACCESS" Player crash when Script Debugging is enabled
- Cursor skips input fields when tabbing between two sets of input fields
- "Shader error redefinition of 'Varyings'" error appears when selecting the shader
Resolution Note:
Steps taken to test: After testing a release editor of 2023.3.0b6, the marked non regressed version on jira I still got the same numbers as on 6.1/6.2. If anything, I noticed a slight improvement on 6.1/staging and 6.2/staging, which might be due to the fact that the code from the marked pr no longer exists on trunk, and we are now caching the ignore pair id on the collider itself.
One thing I noticed in the screenshots is that they were taken with the hierarchy tab instead of the raw hierarchy. If we take a look at the raw hierarchy, you can more clearly see how long each individual call took instead of the sum of all. When observing the individual call cost in the raw hierarchy, I noticed that by sorting for the longest taking call of ignore collision on both 6000.1.0a8 and 2023.3.0b6, 6.1 was slightly cheaper on an individual level. Most of the individual calls of ignore collision on 6.1/6/2 had a duration of 0.00ms with a few being above this with a range between 0.00 and 0.05ms, while on 2023.3.0b6 it took between 0.00ms and 0.57ms. It would be quite difficult to optimize this further.
On a final note, this API isn't really meant to be used on a large scale like this and generally collision layers are used for this.
Resolution Note (fix version 6000.2.0a3):
Fixed performance regression on Physics.IgnoreCollisions() when calling the specified API in large quantities.
Resolution Note (fix version 6000.1.0b6):
Fixed performance regression on Physics.IgnoreCollisions() when calling the specified API in large quantities.
Resolution Note (fix version 6000.0.38f1):
Fixed performance regression on Physics.IgnoreCollisions() when calling the specified API in large quantities.