0.0 如果你想检查某一个函数循环的时间
System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); stopwatch.Start(); //这里是你想检测的时间 stopwatch.Stop(); System.TimeSpan timeSpan = stopwatch.Elapsed; double hours = timeSpan.TotalHours; double minutes = timeSpan.TotalMinutes; double seconds = timeSpan.TotalSeconds; double milliseconds = timeSpan.TotalMilliseconds; Debug.Log("总小时:" + hours); Debug.Log("总分钟:" + minutes); Debug.Log("总秒:" + seconds); Debug.Log("总毫秒:" + milliseconds);
时间: 2024-10-01 01:29:17