From c1df5efffec045768f97d1e03bd46972d4f2dde7 Mon Sep 17 00:00:00 2001 From: mofrison Date: Tue, 30 Jun 2020 16:21:08 +0300 Subject: [PATCH] Fix adding buildIndex scenes to freeIndexes --- Runtime/Core/SceneSub.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Runtime/Core/SceneSub.cs b/Runtime/Core/SceneSub.cs index e43d3a0e..af468ff1 100644 --- a/Runtime/Core/SceneSub.cs +++ b/Runtime/Core/SceneSub.cs @@ -71,7 +71,7 @@ static void RemoveOp(string sceneName) LayerKernel.LoadJobs.Add(SceneManager.UnloadSceneAsync(sceneName)); LayerKernel.LoadJobs.Add(Resources.UnloadUnusedAssets()); loadedScenes.Remove(sceneName); - freeIndexes.Push(layerIndex); + if (layerIndex >= SceneManager.sceneCountInBuildSettings) { freeIndexes.Push(layerIndex); } } internal static int GetLayerIndex(string sceneName)