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
- "Physics.IgnoreCollision" is not respected when used with "Rigidbody.SweepTest"
- GridView does not update with new items when added at runtime until Aspect Ratio is changed
- [iOS] WebGL Player crashes when using certain iOS devices
- Bad performance when executing the Physics.IgnoreCollisions() method while in Play Mode
- Sprite Editor has a thicker separator between buttons when "Sprite Editor" option is selected
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.