Unity - Manual: CPU Usage Profiler module tells me I should click mem record. But how?
There is not button. I tried several things like activating il2cpp, run as admin, build and profile, but there is no button. How to activate that? I have a gc collect lag and do not find it for weeks now without finding out what causes it… Thanks for your help!
JonPQ
2
Window->MemoryProfiler
or as you are doign already in your screenshot
Window->profiler, then look down a bit to the “Memory” section to see details on what is happenning there, compared to the CPU section at the top.
You can also pause the game. drag the verticcal line to where you want, select the memory section.
Then in bottom left you’ll see “simple” summary, change that to “Detailed” and click “Take Sample Editor” that will give you a detailed breakdown of memory at that time.
Also, try this trhread on optimizing garbage collection in Unity/c#
You can see where memory that is monitored by the GC is being allocated by looking out for GC.Alloc samples. Newer Unity versions (At Least 2017.3 and up) collect that info without you needing to toggle it on.
Additionally you can click on the Allocation Callstacks dropdown and Select Managed Callstacks. Frames that have been recorded with this on will show the callstack that led to a GC.Alloc Sample in the selection-tooltip of timeline view, or you can see them when selecting “N/A” Objects as shown in the “Show Related Objects” Details side panel of Hierarchy view.
As of 2019.3, that also works when profiling built players, in previous versions it only works in the Editor.