diff --git a/Assets/YooAsset/Runtime/YooAssets.cs b/Assets/YooAsset/Runtime/YooAssets.cs
index 8a762d70..cb0f5c7b 100644
--- a/Assets/YooAsset/Runtime/YooAssets.cs
+++ b/Assets/YooAsset/Runtime/YooAssets.cs
@@ -131,6 +131,17 @@ namespace YooAsset
if (package == null)
return false;
+ return RemovePackage(package);
+ }
+
+ ///
+ /// 移除资源包
+ ///
+ /// 资源包实例对象
+ public static bool RemovePackage(ResourcePackage package)
+ {
+ CheckException(package);
+ string packageName = package.PackageName;
if (package.InitializeStatus != EOperationStatus.None)
{
YooLogger.Error($"The resource package {packageName} has not been destroyed, please call the method {nameof(ResourcePackage.DestroyAsync)} to destroy!");
@@ -181,6 +192,14 @@ namespace YooAsset
if (string.IsNullOrEmpty(packageName))
throw new Exception("Package name is null or empty !");
}
+ private static void CheckException(ResourcePackage package)
+ {
+ if (_isInitialize == false)
+ throw new Exception($"{nameof(YooAssets)} not initialize !");
+
+ if (package == null)
+ throw new Exception("Package instance is null !");
+ }
#region 系统参数
///