Update YooAssets

在更新资源清单之前检查已加载资源包并给与警告。
pull/40/head
hevinci 2022-09-08 17:04:39 +08:00
parent 6df57cd3cd
commit d697ebe521
2 changed files with 20 additions and 0 deletions

View File

@ -346,6 +346,15 @@ namespace YooAsset
report.ProviderInfos.Sort();
return report;
}
internal static List<BundleInfo> GetLoadedBundleInfos()
{
List<BundleInfo> result = new List<BundleInfo>(100);
foreach (var bundleLoader in _loaders)
{
result.Add(bundleLoader.MainBundleInfo);
}
return result;
}
#endregion
}
}

View File

@ -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 私有方法