update runtime code

增加DestroyPackage()方法
pull/102/head
hevinci 2023-04-22 11:22:28 +08:00
parent 29358a7b4b
commit 70fc85e456
1 changed files with 16 additions and 0 deletions

View File

@ -99,6 +99,7 @@ namespace YooAsset
if (HasPackage(packageName)) if (HasPackage(packageName))
throw new Exception($"Package {packageName} already existed !"); throw new Exception($"Package {packageName} already existed !");
YooLogger.Log($"Create resource package : {packageName}");
ResourcePackage package = new ResourcePackage(packageName); ResourcePackage package = new ResourcePackage(packageName);
_packages.Add(package); _packages.Add(package);
return package; return package;
@ -136,6 +137,21 @@ namespace YooAsset
return null; return null;
} }
/// <summary>
/// 销毁资源包
/// </summary>
/// <param name="package">资源包对象</param>
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();
}
/// <summary> /// <summary>
/// 检测资源包是否存在 /// 检测资源包是否存在
/// </summary> /// </summary>