Is it possible to use Deep Profile to determine the time to execute specific functions in Profiler? When I try Deep Profile in Profiler I get a profile for my Update functions, but within that I only get times for “StackTraceUtility.PostProcessStacktrace()” and not for the functions contained in Update.
1 Answer
1You can provide bits of code with a specific label if you have access to the source code. This allow you to get more control about what is displayed in the profiler.
Profiler.BeginSample ("MyPieceOfCode");
// do something that takes a lot of time
Profiler.EndSample ();
broken link, here is fresh: https://docs.unity3d.com/ScriptReference/Profiling.Profiler.BeginSample.html By the way, I couldn't get it to work like the docs are saying. Even with "using UnityEngine", I had to call UnityEngine.Profiling.Profiler to be able to invoke it
– IgorAherne
Comment out your debug. Debug logging can be disproportionately expenseive at times.
– syclamothThanks. That actually fixes my problem and removes my immediate need to profile specific functions though it be good to find out if that's possible.
– davedevJust wanted to add that this fixed my issue as well. Debug.drawline gets expensive very fast during grid pathfinding. Navigating a small 20x20 grid took 600ms a call because of all the logging.
– JChilton