In editor, I see massive and regular spikes from GC.Collect which freeze the game for anywhere from 200ms to over 1000ms. These spikes do not register in the normal profiler mode, only when profiling the editor itself. These spikes (and game freezing) also do not occur in standalone builds at all, only when testing in-editor, and always related to GUI in some way. I do not have any UI in the scene, only a camera and meshes. Do you know what might be causing these huge spikes, and/or how I might fix this?
Full disclosure: this is part of a procedural, voxel prototype, which I know are prone to performance and memory management issues. I’ve done my best to structure the code to be performant, and limit unnecessary GC parsing of the heap, thanks to the profiler - that said, I can’t rule out that something from gameplay isn’t increasing the workload for the editor in some way, leading to this issue. I’m hoping that someone might be able to shed some light.
Sorry in advance if the formatting is bad, new lines aren’t showing up in the preview…
It looks as though the GC calls are under IMGUI for the Unity Editor itself; in particular the game view panel. I would imagine it's just part of how the game view is drawn/maybe even the profiler. Do you still get these spikes when running the scene normally, or only when profiling the game view?
– SelffertilizationNo matter what windows I leave open or close, the spikes don't change. Even with the profiler not recording and closed. I did notice that changing my world's size (like "view distance" in Minecraft) changes the severity of the spikes, but I just can't see/understand the connection between world size and editor GUI. Still runs perfectly in a build, but it makes testing in editor a challenge.
– Wend