获取某个方法执行的时间 System.Diagnostics; Stopwatch sw = new Stopwatch(); sw.Start(); TestMethod(); sw.Stop(); UnityEngine.Debug.Log(string.Format("total: {0} ms",sw.ElapsedMilliseconds));