Search Issue Tracker
Fixed in 2.0.0
Votes
0
Found in [Package]
1.0.1 preview
Issue ID
1097050
Regression
No
384B GC Alloc in GUIUtility.BeginGUI when using Pixel Perfect Camera
Steps to reproduce:
1. Create new project
2. Import 2D Pixel Perfect package
3. Add Pixel Perfect Camera component to the Main Camera
4. Enter Playmode
5. Open Profiler and look at GC Alloc
Expected result: no extra GC Alloc
Actual result: Extra 384 B in GC only when Pixel Perfect Camera is enabled
Reproducible with: 2018.2.20f1, 2018.3.1f1, 2019.1.0a12
Reproducible with: 1.0.1 preview
-
PauliSavolainen
Jul 20, 2020 06:16
I would suggest to create a separate component such as PixelPerfectDebug attached to the PixelPerfectCamera and move the OnGUI implementation to the debug component. Only when there is something to show the debug component would be enabled. This way OnGUI wouldn't cause GC even in editor/development mode. It is somewhat annoying to see the 384B when profiling in the editor.
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
- Silent crash when clicking in Scene View in a specific project
- The Player renders black on a Quest headset when MSAA, Post Processing, and Spacewarm depth submission are enabled
- Graphics Compositor breaks Unity rendering when the "Output Camera" is changed to a scene Camera and one Camera SubLayer is active
- The Editor freezes on RenderGraphViewer.Repaint when entering too many characters in search fields without character limits
- Adding a new SubLayer in Graphics Compositor renders BaseLayer darker and makes it flicker
Resolution Note (fix version 2.0.0):
The GC allocation is caused by having an OnGUI() callback in the PixelPerfectCamera component. I made OnGUI() only available in the Editor and development builds, as I think it's still useful to have on-screen warning messages, but the GC allocation will be gone in non-development player builds.