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

  1. 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.

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.