diff --git a/Assets/YooAsset/Runtime/ResourceManager/Loader/BundleLoaderBase.cs b/Assets/YooAsset/Runtime/ResourceManager/Loader/BundleLoaderBase.cs index 0d651b0..b7e7080 100644 --- a/Assets/YooAsset/Runtime/ResourceManager/Loader/BundleLoaderBase.cs +++ b/Assets/YooAsset/Runtime/ResourceManager/Loader/BundleLoaderBase.cs @@ -116,9 +116,8 @@ namespace YooAsset return; */ - _removeList.Clear(); - // 获取移除列表 + _removeList.Clear(); foreach (var provider in _providers) { if (provider.CanDestroy()) @@ -136,8 +135,6 @@ namespace YooAsset // 移除资源提供者 Impl.RemoveBundleProviders(_removeList); - - _removeList.Clear(); } diff --git a/Assets/YooAsset/Runtime/ResourceManager/Provider/ProviderBase.cs b/Assets/YooAsset/Runtime/ResourceManager/Provider/ProviderBase.cs index 1e2a9e9..d457399 100644 --- a/Assets/YooAsset/Runtime/ResourceManager/Provider/ProviderBase.cs +++ b/Assets/YooAsset/Runtime/ResourceManager/Provider/ProviderBase.cs @@ -199,8 +199,9 @@ namespace YooAsset /// public void ReleaseAllHandles() { - foreach (var handle in _handles) + for (int i = _handles.Count - 1; i >= 0; i--) { + var handle = _handles[i]; handle.ReleaseInternal(); } } diff --git a/Assets/YooAsset/Runtime/YooAssets.cs b/Assets/YooAsset/Runtime/YooAssets.cs index 00e977e..bcf06a6 100644 --- a/Assets/YooAsset/Runtime/YooAssets.cs +++ b/Assets/YooAsset/Runtime/YooAssets.cs @@ -12,6 +12,14 @@ namespace YooAsset private static GameObject _driver = null; private static readonly List _packages = new List(); + /// + /// 是否已经初始化 + /// + public static bool Initialized + { + get { return _isInitialize; } + } + /// /// 初始化资源系统 /// @@ -90,7 +98,7 @@ namespace YooAsset public static ResourcePackage CreatePackage(string packageName) { CheckException(packageName); - if (HasPackage(packageName)) + if (ContainsPackage(packageName)) throw new Exception($"Package {packageName} already existed !"); YooLogger.Log($"Create resource package : {packageName}"); @@ -142,7 +150,7 @@ namespace YooAsset /// 检测资源包是否存在 /// /// 资源包名称 - public static bool HasPackage(string packageName) + public static bool ContainsPackage(string packageName) { CheckException(packageName); var package = GetPackageInternal(packageName);