Search Issue Tracker

Active

Votes

4

Found in

2019.4

2019.4.30f1

2020.3

2021.2

2022.1

Issue ID

1380320

Regression

No

GUIUtility.BeginGUI() causes memory allocations every time when a GameObject with OnGUI() is instantiated

IMGUI

-

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

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.