Search Issue Tracker
Won't Fix
Votes
0
Found in
2023.1.0a1
2023.2.0a1
Issue ID
UUM-3437
Regression
No
GUIUtility.BeginGUI() causes memory allocations every time when a GameObject with OnGUI() is instantiated
How to reproduce:
1. Open attached project "case_1380320.zip"
2. Enter Scene "SampleScene" (Assets > Scenes)
3. Make sure the Profiler window is docked in the Editor (View > Analysis > Profiler)
4. Enter "GUIUtility.BeginGUI()" into a search bar inside of the Profiler window
5. Enter Play Mode
6. Select any frame in the Profiler window
7. In the Profiler window's Overview area observe the value in "GUIUtility.BeginGUI()", "GC Alloc" column
8. In the Hierarchy window copy and paste GameObject "GameObject"
9. In the Profiler window clear the frames by pressing the "Clear" button and unpause Play Mode
10. Select any Frame in the Profiler
11. In the Profiler window's Overview area observe "GUIUtility.BeginGUI()" GC Alloc column
Expected result: The value under the "GC Alloc" does not increase
Actual result: The value under the "GC Alloc" column increases by 0.3-0.4 KB
Reproducible with: 2019.4.0f1, 2019.4.33f1, 2020.3.23f1, 2021.2.4f1, 2022.1.0a16
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
- ":focus" style will not be shown when the UI element is unparented and reparented and the "Focus()" method is called without the "Blur()" method being called
- Crash on BucketAllocator::Allocate when importing TextMeshPro assets
- Playmode dropdown creates continuous "Layout update is struggling" errors at certain aspect ratios
- Editor takes a long time to open VFX Graph 'Subgraph' asset when it is heavily referenced by multiple other VFX Graphs
- "Editor Event Handler Error" error is thrown when using Terrain Tool shortcuts
Resolution Note:
This is performance improvement request on an API framework (IMGUI) that is no longer being improved as we transition to UI Toolkit. This is especially true for IMGUI usage at runtime.