From 70fc85e45636f706730268057204b4cabef2a722 Mon Sep 17 00:00:00 2001 From: hevinci Date: Sat, 22 Apr 2023 11:22:28 +0800 Subject: [PATCH] update runtime code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加DestroyPackage()方法 --- Assets/YooAsset/Runtime/YooAssets.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Assets/YooAsset/Runtime/YooAssets.cs b/Assets/YooAsset/Runtime/YooAssets.cs index 63d7819..07e8ef2 100644 --- a/Assets/YooAsset/Runtime/YooAssets.cs +++ b/Assets/YooAsset/Runtime/YooAssets.cs @@ -99,6 +99,7 @@ namespace YooAsset if (HasPackage(packageName)) throw new Exception($"Package {packageName} already existed !"); + YooLogger.Log($"Create resource package : {packageName}"); ResourcePackage package = new ResourcePackage(packageName); _packages.Add(package); return package; @@ -136,6 +137,21 @@ namespace YooAsset return null; } + /// + /// 销毁资源包 + /// + /// 资源包对象 + public static void DestroyPackage(string packageName) + { + ResourcePackage package = GetPackage(packageName); + if (package == null) + return; + + YooLogger.Log($"Destroy resource package : {packageName}"); + _packages.Remove(package); + package.DestroyPackage(); + } + /// /// 检测资源包是否存在 ///