Update runtime code

This commit is contained in:
hevinci
2022-10-22 17:46:46 +08:00
parent 8eb7816e30
commit ec1c3d6070
7 changed files with 46 additions and 4 deletions

View File

@@ -238,6 +238,17 @@ namespace YooAsset
/// </summary>
public string SpawnTime = string.Empty;
/// <summary>
/// 加载耗时(单位:毫秒)
/// </summary>
public long LoadingTime { protected set; get; }
#if DEBUG
// 加载耗时统计
private bool _isRecording = false;
private Stopwatch _watch;
#endif
[Conditional("DEBUG")]
public void InitSpawnDebugInfo()
{
@@ -251,6 +262,25 @@ namespace YooAsset
float s = UnityEngine.Mathf.FloorToInt(spawnTime - m * 60f - h * 3600f);
return h.ToString("00") + ":" + m.ToString("00") + ":" + s.ToString("00");
}
[Conditional("DEBUG")]
protected void DebugRecording()
{
if (_isRecording == false)
{
_isRecording = true;
_watch = Stopwatch.StartNew();
}
if (_watch != null)
{
if (IsDone)
{
LoadingTime = _watch.ElapsedMilliseconds;
_watch = null;
}
}
}
#endregion
}
}