Update runtime code

pull/51/head
hevinci 2022-11-03 10:37:34 +08:00
parent 0844447b46
commit 9db111c08a
2 changed files with 18 additions and 4 deletions

View File

@ -4,7 +4,7 @@ namespace YooAsset
/// <summary> /// <summary>
/// 下载文件校验结果 /// 下载文件校验结果
/// </summary> /// </summary>
public enum EVerifyResult internal enum EVerifyResult
{ {
/// <summary> /// <summary>
/// 文件不存在 /// 文件不存在

View File

@ -1,22 +1,36 @@
using UnityEngine; using System.Diagnostics;
using UnityEngine;
namespace YooAsset namespace YooAsset
{ {
internal class YooAssetsDriver : MonoBehaviour internal class YooAssetsDriver : MonoBehaviour
{ {
private static int LastestUpdateFrame = 0;
void Update() void Update()
{ {
DebugCheckDuplicateDriver();
YooAssets.Update(); YooAssets.Update();
} }
void OnDestroy() void OnDestroy()
{ {
YooAssets.Destroy(); YooAssets.Destroy();
} }
void OnApplicationQuit() void OnApplicationQuit()
{ {
YooAssets.Destroy(); YooAssets.Destroy();
} }
[Conditional("DEBUG")]
private void DebugCheckDuplicateDriver()
{
if (LastestUpdateFrame > 0)
{
if (LastestUpdateFrame == Time.frameCount)
YooLogger.Warning($"There are two {nameof(YooAssetsDriver)} in the scene. Please ensure there is always exactly one driver in the scene.");
}
LastestUpdateFrame = Time.frameCount;
}
} }
} }