Update YooAssets.cs

pull/455/head
何冠峰 2025-01-17 15:21:35 +08:00
parent 20fac33efc
commit c32e7bc525
1 changed files with 19 additions and 0 deletions

View File

@ -131,6 +131,17 @@ namespace YooAsset
if (package == null)
return false;
return RemovePackage(package);
}
/// <summary>
/// 移除资源包
/// </summary>
/// <param name="package">资源包实例对象</param>
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 系统参数
/// <summary>