Skip to content

Commit ef63123

Browse files
committed
feat(Mgr): Add get all scene util
1 parent 7f93eea commit ef63123

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Assets/JCSUnity/Scripts/Managers/JCS_SceneManager.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99
using System;
1010
using System.IO;
11+
using System.Collections.Generic;
1112
using UnityEngine;
1213
using UnityEngine.SceneManagement;
1314
using MyBox;
@@ -424,6 +425,23 @@ public static string GetSceneNameByOption(string sceneName, bool reload, int off
424425
return sceneName;
425426
}
426427

428+
/// <summary>
429+
/// Return a list of all scenes.
430+
/// </summary>
431+
public static List<Scene> GetAllScenes()
432+
{
433+
List<Scene> scenes = new();
434+
435+
JCS_Loop.Times(SceneManager.sceneCount, (count) =>
436+
{
437+
Scene scene = SceneManager.GetSceneAt(count);
438+
439+
scenes.Add(scene);
440+
});
441+
442+
return scenes;
443+
}
444+
427445
/// <summary>
428446
/// Check is loading the scene or not.
429447
/// </summary>

0 commit comments

Comments
 (0)