性能优化3——脚本获取语句耗时
var beginTime = System.DateTime.UtcNow.Ticks; ............ var endTime = System.DateTime.UtcNow.Ticks; var deltaTime = endTime - beginTime; Debug.Log($"{deltaTime / 10000.0}ms");
中间放入语句即可,非常感谢
Unity中实现一键删除丢失的(Missing)脚本_unity 移除错误的脚本-CSDN博客
方法②:
Stopwatch sw = new Stopwatch(); sw.Start(); ............... sw.Stop(); UnityEngine.Debug.Log(string.Format("Stopwatch total: {0} ms",sw.ElapsedMilliseconds));