Skip to main content
Glama
SceneData.cs2.26 kB
/* ┌──────────────────────────────────────────────────────────────────┐ │ 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 System.Linq; namespace com.IvanMurzak.Unity.MCP.Runtime.Data { public class SceneData : SceneDataShallow { public List<GameObjectData>? RootGameObjects { get; set; } = null; public SceneData() { } public SceneData( UnityEngine.SceneManagement.Scene scene, bool includeRootGameObjects = false, int includeChildrenDepth = 0, bool deepSerialization = false, bool includeBounds = false, bool includeData = false) : base(scene) { if (includeRootGameObjects) { this.RootGameObjects = scene.GetRootGameObjects() .Select(go => go.ToGameObjectData( includeData: includeData, includeBounds: includeBounds, includeHierarchy: includeChildrenDepth > 0, hierarchyDepth: includeChildrenDepth, deepSerialization: deepSerialization )) .ToList(); } } } public static class SceneDataExtensions { public static SceneData ToSceneData( this UnityEngine.SceneManagement.Scene scene, bool includeRootGameObjects = false) { return new SceneData(scene, includeRootGameObjects: includeRootGameObjects); } } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/IvanMurzak/Unity-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server