feat : add load scene sync method

pull/252/head
hevinci 2024-03-08 15:39:25 +08:00
parent f4ddaedbf4
commit 2a5a2626a4
1 changed files with 7 additions and 0 deletions

View File

@ -35,6 +35,12 @@ namespace YooAsset
// 1. 检测资源包 // 1. 检测资源包
if (_steps == ESteps.CheckBundle) if (_steps == ESteps.CheckBundle)
{ {
if (IsWaitForAsyncComplete)
{
DependBundles.WaitForAsyncComplete();
OwnerBundle.WaitForAsyncComplete();
}
if (DependBundles.IsDone() == false) if (DependBundles.IsDone() == false)
return; return;
if (OwnerBundle.IsDone() == false) if (OwnerBundle.IsDone() == false)
@ -62,6 +68,7 @@ namespace YooAsset
{ {
if (IsWaitForAsyncComplete || IsForceDestroyComplete) if (IsWaitForAsyncComplete || IsForceDestroyComplete)
{ {
// 注意:场景同步加载方法不会立即加载场景,而是在下一帧加载。
LoadSceneParameters parameters = new LoadSceneParameters(SceneMode); LoadSceneParameters parameters = new LoadSceneParameters(SceneMode);
SceneObject = SceneManager.LoadScene(MainAssetInfo.AssetPath, parameters); SceneObject = SceneManager.LoadScene(MainAssetInfo.AssetPath, parameters);
_steps = ESteps.Checking; _steps = ESteps.Checking;