方法一:
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();