Search Issue Tracker
Fixed in 2020.1.X
Fixed in 2018.4.X, 2019.4.X, 2020.2.X
[Profiler] Hierarchy randomly hides parts of the sample hierarchy if Editor Only Samples are present and set to be Collapsed
How to reproduce:
1. Open any Unity Project
2. Open the Profiler Window (Ctrl/Cmd +7)
3. Load in the Attached profiler data file
4. Got to frame 1, Select the CPU Usage Profiler Module and set it to Hierarchy view
5. Sort the samples in the Hierarchy view by Name
5. Look for this sample (path notation):
PlayerLoop / Update.ScriptRunBehaviourUpdate / BehaviourUpdate / EditorOnlySample.Update() / Update 1057
6. Notice that it doesn't have any child samples, unlike it's similarly named siblings
7. In the far right end of the Hierarchy view's toolbar, click on the three dots kebab-menu (cogwheel pre 2019.3) and toggle off "Collapse EditorOnly Samples"
8. Find the sample again and see that it has child samples now.
The code causing this Profiler data has been attached but basically it 1000 GameObjects spamming Editor Only Samples by triggering the GetComponent NullCheck
Profiler.BeginSample("Update " + (i++));
var nonExisting = GetComponent<RectTransform>();
so each of these samples should have the same kind of child samples.
Expected result: The Profiler shows that all "Update X" have a similar structure of child samples. "Collapse EditorOnly Samples" only affects samples that are then renamed to clarify that they are Editor Only samples, that have been collapsed.
Actual result: The Profiler wrongfuly collapses some non-editor-only "Update X" samples and thereby hides its child samples.
Reproducible with: 2018.4.20f1, 2019.4.16f1, 2020.1.16f1, 2020.2.0b14, 2021.1.0a6
Not reproducible with: 2018.2 (Collapsing Editor Only samples was only introduced in 2018.3), 2021.1.0a7 (was already fixed)
Note: there are several other "Update X" samples affected, e.g. "Update 1074" "Update 1441" "Update 1724"
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- ShaderUtil.GetShaderData(shader).SubshaderCount does not count unsupported subshader
- GameObject.GetComponents returns the wrong number of components
- GUI button looks different from Editor in a Build
- Live Profiler Timeline keeps losing frame data while scrolling inside Profiler window
- Input.mouseScrollDelta.y is not correctly mapped to mouse wheel when running an iOS app on Apple Silicon Mac