| | 1 | | // Copyright (c) 2020-2024 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.SceneManagement; |
| | 6 | |
|
| | 7 | | namespace GDX |
| | 8 | | { |
| | 9 | | public static class SceneExtensions |
| | 10 | | { |
| | 11 | | /// <summary> |
| | 12 | | /// Indicates if there are scenes unloading, loading, or scenes that have yet to be integrated and enabled. |
| | 13 | | /// </summary> |
| | 14 | | /// <returns>true/false if there is work being done.</returns> |
| | 15 | | public static bool IsSceneManagerBusy() |
| 0 | 16 | | { |
| 0 | 17 | | int sceneCount = SceneManager.sceneCount; |
| 0 | 18 | | for (int i = 0; i < sceneCount; i++) |
| 0 | 19 | | { |
| 0 | 20 | | Scene scene = SceneManager.GetSceneAt(i); |
| 0 | 21 | | if (!scene.isLoaded) |
| 0 | 22 | | { |
| 0 | 23 | | return true; |
| | 24 | | } |
| 0 | 25 | | } |
| | 26 | |
|
| 0 | 27 | | return false; |
| 0 | 28 | | } |
| | 29 | | } |
| | 30 | | } |