| | 1 | | // Copyright (c) 2020-2022 dotBunny Inc. |
| | 2 | | // dotBunny licenses this file to you under the BSL-1.0 license. |
| | 3 | | // See the LICENSE file in the project root for more information. |
| | 4 | |
|
| | 5 | | using UnityEngine; |
| | 6 | | using UnityEngine.SceneManagement; |
| | 7 | |
|
| | 8 | | namespace GDX.Developer.ConsoleCommands |
| | 9 | | { |
| | 10 | | #if UNITY_2022_2_OR_NEWER |
| | 11 | | public class SceneListConsoleCommand : ConsoleCommandBase |
| | 12 | | { |
| | 13 | | /// <inheritdoc /> |
| | 14 | | public override bool Evaluate(float deltaTime) |
| 0 | 15 | | { |
| 0 | 16 | | TextGenerator textGenerator = new TextGenerator(); |
| 0 | 17 | | int sceneCount = SceneManager.sceneCountInBuildSettings; |
| 0 | 18 | | for (int i = 0; i < sceneCount; i++) |
| 0 | 19 | | { |
| 0 | 20 | | Scene scene = SceneManager.GetSceneByBuildIndex(i); |
| 0 | 21 | | if (scene.IsValid()) |
| 0 | 22 | | { |
| 0 | 23 | | textGenerator.AppendLine($"{i}\t\t{scene.name}"); |
| 0 | 24 | | } |
| 0 | 25 | | } |
| | 26 | |
|
| 0 | 27 | | Debug.Log(textGenerator.ToString()); |
| 0 | 28 | | return true; |
| 0 | 29 | | } |
| | 30 | |
|
| | 31 | | /// <inheritdoc /> |
| | 32 | | public override string GetKeyword() |
| 7 | 33 | | { |
| 7 | 34 | | return "scene.list"; |
| 7 | 35 | | } |
| | 36 | |
|
| | 37 | | /// <inheritdoc /> |
| | 38 | | public override string GetHelpMessage() |
| 0 | 39 | | { |
| 0 | 40 | | return "Displays a list of known scenes in the build."; |
| 0 | 41 | | } |
| | 42 | | } |
| | 43 | | #endif // UNITY_2022_2_OR_NEWER |
| | 44 | | } |