/*
┌──────────────────────────────────────────────────────────────────┐
│ Author: Ivan Murzak (https://github.com/IvanMurzak) │
│ Repository: GitHub (https://github.com/IvanMurzak/Unity-MCP) │
│ Copyright (c) 2025 Ivan Murzak │
│ Licensed under the Apache License, Version 2.0. │
│ See the LICENSE file in the project root for more information. │
└──────────────────────────────────────────────────────────────────┘
*/
#nullable enable
using System.Collections.Generic;
using com.IvanMurzak.Unity.MCP.Runtime.Data;
using UnityEngine.SceneManagement;
namespace com.IvanMurzak.Unity.MCP.Runtime.Utils
{
public static partial class SceneUtils
{
public static Scene GetActiveScene()
=> SceneManager.GetActiveScene();
public static IEnumerable<Scene> GetAllLoadedScenes()
{
var sceneCount = SceneManager.sceneCount;
for (var i = 0; i < sceneCount; i++)
{
var scene = SceneManager.GetSceneAt(i);
if (scene.isLoaded)
yield return scene;
}
}
public static SceneMetadata? ToMetadata(this Scene scene, int includeChildrenDepth = 3)
=> SceneMetadata.FromScene(scene, includeChildrenDepth);
}
}