Skip to content

Scene API

Daisuke Tsukada edited this page Dec 19, 2025 · 1 revision

Scene API

シーン操作に関する API です。

API 一覧

API 説明
unity.scene.list シーン内のオブジェクト一覧を取得
unity.scene.getActive アクティブシーンの情報を取得
unity.scene.create 新しいシーンを作成
unity.scene.open シーンを開く
unity.scene.save シーンを保存
unity.scene.getHierarchy シーン階層を取得
unity.scene.find オブジェクトを検索

unity.scene.list

シーン内のすべてのルートオブジェクトを取得します。

パラメータ

名前 必須 説明
maxDepth integer No 取得する階層の深さ(デフォルト: 1)

レスポンス

{
  "sceneName": "SampleScene",
  "objects": [
    {
      "name": "Main Camera",
      "path": "/Main Camera",
      "children": []
    },
    {
      "name": "Directional Light",
      "path": "/Directional Light",
      "children": []
    }
  ]
}

unity.scene.find

名前やパスでオブジェクトを検索します。

パラメータ

名前 必須 説明
query string Yes 検索クエリ(名前または部分一致)
searchType string No 検索タイプ: "name", "path", "tag"

レスポンス

{
  "results": [
    {
      "name": "Player",
      "path": "/Player",
      "instanceId": 12345
    }
  ]
}

unity.scene.getHierarchy

シーンの完全な階層構造を取得します。

パラメータ

名前 必須 説明
maxDepth integer No 最大階層深度

レスポンス

{
  "sceneName": "SampleScene",
  "rootObjects": [
    {
      "name": "Canvas",
      "path": "/Canvas",
      "children": [
        {
          "name": "Button",
          "path": "/Canvas/Button",
          "children": []
        }
      ]
    }
  ]
}

Clone this wiki locally