diff --git a/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs b/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs
index 4a87bf3..cb62f8e 100644
--- a/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs
+++ b/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs
@@ -63,6 +63,19 @@ namespace YooAsset
}
}
+ ///
+ /// 销毁
+ ///
+ public static void DestroyAll()
+ {
+ _loaders.Clear();
+ _providers.Clear();
+ _sceneHandles.Clear();
+
+ DecryptionServices = null;
+ BundleServices = null;
+ }
+
///
/// 资源回收(卸载引用计数为零的资源)
///
diff --git a/Assets/YooAsset/Runtime/AssetSystem/Operations/InstantiateOperation.cs b/Assets/YooAsset/Runtime/AssetSystem/Operations/InstantiateOperation.cs
index 7ce6d6f..1241982 100644
--- a/Assets/YooAsset/Runtime/AssetSystem/Operations/InstantiateOperation.cs
+++ b/Assets/YooAsset/Runtime/AssetSystem/Operations/InstantiateOperation.cs
@@ -51,6 +51,9 @@ namespace YooAsset
return;
}
+ if (_handle.IsDone == false)
+ return;
+
if (_handle.AssetObject == null)
{
_steps = ESteps.Done;
diff --git a/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystem.cs b/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystem.cs
index 2b59106..a1062e2 100644
--- a/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystem.cs
+++ b/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystem.cs
@@ -58,7 +58,9 @@ namespace YooAsset
downloader.Abort();
}
_downloaderDic.Clear();
- YooLogger.Log("DownloadSystem destroy all !");
+ _removeList.Clear();
+ _cachedHashList.Clear();
+ _breakpointResumeFileSize = int.MaxValue;
}
diff --git a/Assets/YooAsset/Runtime/OperationSystem/OperationSystem.cs b/Assets/YooAsset/Runtime/OperationSystem/OperationSystem.cs
index 3733c12..6442e46 100644
--- a/Assets/YooAsset/Runtime/OperationSystem/OperationSystem.cs
+++ b/Assets/YooAsset/Runtime/OperationSystem/OperationSystem.cs
@@ -45,6 +45,17 @@ namespace YooAsset
}
}
+ ///
+ /// 销毁异步操作系统
+ ///
+ public static void DestroyAll()
+ {
+ _operations.Clear();
+ _watch = null;
+ _maxTimeSlice = 0;
+ _frameTime = 0;
+ }
+
///
/// 开始处理异步操作类
///
diff --git a/Assets/YooAsset/Runtime/YooAssetDriver.cs b/Assets/YooAsset/Runtime/YooAssetDriver.cs
index 0aac75d..466f5a2 100644
--- a/Assets/YooAsset/Runtime/YooAssetDriver.cs
+++ b/Assets/YooAsset/Runtime/YooAssetDriver.cs
@@ -11,7 +11,7 @@ namespace YooAsset
void OnApplicationQuit()
{
- DownloadSystem.DestroyAll();
+ YooAssets.InternalDestroy();
}
}
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/YooAssets.cs b/Assets/YooAsset/Runtime/YooAssets.cs
index 355f405..0e0338d 100644
--- a/Assets/YooAsset/Runtime/YooAssets.cs
+++ b/Assets/YooAsset/Runtime/YooAssets.cs
@@ -925,15 +925,27 @@ namespace YooAsset
#endregion
#region 内部方法
+ internal static void InternalDestroy()
+ {
+ _isInitialize = false;
+ _initializeError = string.Empty;
+ _initializeStatus = EOperationStatus.None;
+
+ _bundleServices = null;
+ _locationServices = null;
+ _editorSimulateModeImpl = null;
+ _offlinePlayModeImpl = null;
+ _hostPlayModeImpl = null;
+
+ OperationSystem.DestroyAll();
+ DownloadSystem.DestroyAll();
+ AssetSystem.DestroyAll();
+ YooLogger.Log("YooAssets destroy all !");
+ }
internal static void InternalUpdate()
{
- // 更新异步操作系统
OperationSystem.Update();
-
- // 更新下载管理系统
DownloadSystem.Update();
-
- // 更新资源系统
AssetSystem.Update();
}