Files
YooAsset/Assets/YooAsset/Runtime/YooAssetsDriver.cs

28 lines
602 B
C#
Raw Normal View History

2022-11-03 10:37:34 +08:00
using System.Diagnostics;
using UnityEngine;
2022-03-03 18:07:58 +08:00
namespace YooAsset
{
2022-10-14 11:19:23 +08:00
internal class YooAssetsDriver : MonoBehaviour
2022-04-04 22:43:42 +08:00
{
2022-11-03 10:37:34 +08:00
private static int LastestUpdateFrame = 0;
2022-04-04 22:43:42 +08:00
void Update()
{
2022-11-03 10:37:34 +08:00
DebugCheckDuplicateDriver();
2022-09-29 18:40:43 +08:00
YooAssets.Update();
2022-04-04 22:43:42 +08:00
}
2022-11-03 10:37:34 +08:00
[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;
}
2022-04-04 22:43:42 +08:00
}
2022-03-03 18:07:58 +08:00
}