diff --git a/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs b/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs index b293b0e..0f295ae 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs @@ -79,30 +79,6 @@ namespace YooAsset _isUnloadSafe = true; } - /// - /// 销毁 - /// - public void DestroyAll() - { - foreach (var provider in _providerList) - { - provider.Destroy(); - } - _providerList.Clear(); - _providerDic.Clear(); - - foreach (var loader in _loaderList) - { - loader.Destroy(true); - } - _loaderList.Clear(); - _loaderDic.Clear(); - - ClearSceneHandle(); - DecryptionServices = null; - BundleServices = null; - } - /// /// 资源回收(卸载引用计数为零的资源) /// @@ -149,10 +125,12 @@ namespace YooAsset { foreach (var provider in _providerList) { + provider.WaitForAsyncComplete(); provider.Destroy(); } foreach (var loader in _loaderList) { + loader.WaitForAsyncComplete(); loader.Destroy(true); } diff --git a/Assets/YooAsset/Runtime/PackageSystem/ResourcePackage.cs b/Assets/YooAsset/Runtime/PackageSystem/ResourcePackage.cs index c234ece..5aba8fe 100644 --- a/Assets/YooAsset/Runtime/PackageSystem/ResourcePackage.cs +++ b/Assets/YooAsset/Runtime/PackageSystem/ResourcePackage.cs @@ -62,7 +62,7 @@ namespace YooAsset if (_assetSystemImpl != null) { - _assetSystemImpl.DestroyAll(); + _assetSystemImpl.ForceUnloadAllAssets(); _assetSystemImpl = null; } }