From d697ebe521cf39c309209125ea5a949954546e28 Mon Sep 17 00:00:00 2001 From: hevinci Date: Thu, 8 Sep 2022 17:04:39 +0800 Subject: [PATCH] Update YooAssets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在更新资源清单之前检查已加载资源包并给与警告。 --- Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs | 9 +++++++++ Assets/YooAsset/Runtime/YooAssets.cs | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs b/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs index 8f40902..9d0b965 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs @@ -346,6 +346,15 @@ namespace YooAsset report.ProviderInfos.Sort(); return report; } + internal static List GetLoadedBundleInfos() + { + List result = new List(100); + foreach (var bundleLoader in _loaders) + { + result.Add(bundleLoader.MainBundleInfo); + } + return result; + } #endregion } } \ No newline at end of file diff --git a/Assets/YooAsset/Runtime/YooAssets.cs b/Assets/YooAsset/Runtime/YooAssets.cs index dbb1ed1..b7d7470 100644 --- a/Assets/YooAsset/Runtime/YooAssets.cs +++ b/Assets/YooAsset/Runtime/YooAssets.cs @@ -294,6 +294,7 @@ namespace YooAsset public static UpdateManifestOperation UpdateManifestAsync(int resourceVersion, int timeout = 60) { DebugCheckInitialize(); + DebugCheckUpdateManifest(); if (_playMode == EPlayMode.EditorSimulateMode) { var operation = new EditorPlayModeUpdateManifestOperation(); @@ -1130,6 +1131,16 @@ namespace YooAsset YooLogger.Warning($"Found illegal character in location : \"{location}\""); } } + + [Conditional("DEBUG")] + private static void DebugCheckUpdateManifest() + { + var loadedBundleInfos = AssetSystem.GetLoadedBundleInfos(); + if(loadedBundleInfos.Count > 0) + { + YooLogger.Warning($"Found loaded bundle before update manifest ! Recommended to call the {nameof(ForceUnloadAllAssets)} method to release loaded bundle !"); + } + } #endregion #region 私有方法