From e94923c3c63b0b2fbaa2e70fa8e74dde1f417905 Mon Sep 17 00:00:00 2001 From: hevinci Date: Sat, 26 Nov 2022 11:29:39 +0800 Subject: [PATCH] Update AssetSystem --- Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs b/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs index e528bc3..e6b3a39 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs @@ -90,6 +90,15 @@ namespace YooAsset /// 资源回收(卸载引用计数为零的资源) /// public void UnloadUnusedAssets() + { + // 注意:资源包之间可能存在多层深层嵌套,需要多次循环释放。 + int loopCount = 10; + for (int i = 0; i < loopCount; i++) + { + UnloadUnusedAssetsInternal(); + } + } + private void UnloadUnusedAssetsInternal() { if (_simulationOnEditor) {