From 2a5a2626a43fe0ab624450b25f624d162fc4fa6b Mon Sep 17 00:00:00 2001 From: hevinci Date: Fri, 8 Mar 2024 15:39:25 +0800 Subject: [PATCH] feat : add load scene sync method --- .../ResourceManager/Provider/BundledSceneProvider.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Assets/YooAsset/Runtime/ResourceManager/Provider/BundledSceneProvider.cs b/Assets/YooAsset/Runtime/ResourceManager/Provider/BundledSceneProvider.cs index b6710f8..1666c64 100644 --- a/Assets/YooAsset/Runtime/ResourceManager/Provider/BundledSceneProvider.cs +++ b/Assets/YooAsset/Runtime/ResourceManager/Provider/BundledSceneProvider.cs @@ -35,6 +35,12 @@ namespace YooAsset // 1. 检测资源包 if (_steps == ESteps.CheckBundle) { + if (IsWaitForAsyncComplete) + { + DependBundles.WaitForAsyncComplete(); + OwnerBundle.WaitForAsyncComplete(); + } + if (DependBundles.IsDone() == false) return; if (OwnerBundle.IsDone() == false) @@ -62,6 +68,7 @@ namespace YooAsset { if (IsWaitForAsyncComplete || IsForceDestroyComplete) { + // 注意:场景同步加载方法不会立即加载场景,而是在下一帧加载。 LoadSceneParameters parameters = new LoadSceneParameters(SceneMode); SceneObject = SceneManager.LoadScene(MainAssetInfo.AssetPath, parameters); _steps = ESteps.Checking;