方法一:
Stopwatch sw =
new
Stopwatch();
sw.Start();
TestMethod();
sw.Stop();
UnityEngine.Debug.Log(
string
.Format(
"total: {0} ms"
,sw.ElapsedMilliseconds));
方法二:需要打開
打開Profiler界面找到那一幀
Profiler.BeginSample(
"TestMethod"
);
TestMethod();
Profiler.EndSample();