diff --git a/Assets/YooAsset/Runtime/CacheSystem/CacheSystem.cs b/Assets/YooAsset/Runtime/CacheSystem/CacheSystem.cs index 94310ae..e4f7848 100644 --- a/Assets/YooAsset/Runtime/CacheSystem/CacheSystem.cs +++ b/Assets/YooAsset/Runtime/CacheSystem/CacheSystem.cs @@ -23,6 +23,15 @@ namespace YooAsset _cachedDic.Clear(); } + /// + /// 清空指定包裹的所有缓存数据 + /// + public static void ClearPackage(string packageName) + { + var cache = GetOrCreateCache(packageName); + cache.ClearAll(); + } + /// /// 获取缓存文件总数 /// @@ -115,7 +124,7 @@ namespace YooAsset { return VerifyingInternal(element.TempDataFilePath, element.FileSize, element.FileCRC, EVerifyLevel.High); } - + /// /// 验证记录文件(主线程内操作) /// diff --git a/Assets/YooAsset/Runtime/YooAssets.cs b/Assets/YooAsset/Runtime/YooAssets.cs index b75a9c5..cf93c23 100644 --- a/Assets/YooAsset/Runtime/YooAssets.cs +++ b/Assets/YooAsset/Runtime/YooAssets.cs @@ -150,6 +150,9 @@ namespace YooAsset YooLogger.Log($"Destroy resource package : {packageName}"); _packages.Remove(package); package.DestroyPackage(); + + // 清空缓存 + CacheSystem.ClearPackage(packageName); } ///