Skip to content

Component API

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

Component API

コンポーネント操作に関する API です。

API 一覧

API 説明
unity.component.add コンポーネントを追加
unity.component.remove コンポーネントを削除
unity.component.get コンポーネント情報を取得
unity.component.list オブジェクトのコンポーネント一覧
unity.component.setProperty プロパティを設定
unity.component.getProperty プロパティを取得

unity.component.add

GameObject にコンポーネントを追加します。

パラメータ

名前 必須 説明
path string Yes オブジェクトのパス
componentType string Yes コンポーネント型名(例: "Rigidbody", "BoxCollider")

レスポンス

{
  "success": true,
  "componentType": "Rigidbody",
  "gameObjectPath": "/Player"
}

unity.component.remove

コンポーネントを削除します。

パラメータ

名前 必須 説明
path string Yes オブジェクトのパス
componentType string Yes 削除するコンポーネント型名

レスポンス

{
  "success": true,
  "removed": "Rigidbody"
}

unity.component.list

オブジェクトにアタッチされているコンポーネント一覧を取得します。

パラメータ

名前 必須 説明
path string Yes オブジェクトのパス

レスポンス

{
  "gameObjectPath": "/Player",
  "components": [
    "Transform",
    "MeshFilter",
    "MeshRenderer",
    "Rigidbody",
    "BoxCollider"
  ]
}

unity.component.setProperty

コンポーネントのプロパティを設定します。

パラメータ

名前 必須 説明
path string Yes オブジェクトのパス
componentType string Yes コンポーネント型名
propertyName string Yes プロパティ名
value any Yes 設定する値

レスポンス

{
  "success": true,
  "componentType": "Rigidbody",
  "propertyName": "mass",
  "newValue": 10.0
}

unity.component.getProperty

コンポーネントのプロパティ値を取得します。

パラメータ

名前 必須 説明
path string Yes オブジェクトのパス
componentType string Yes コンポーネント型名
propertyName string Yes プロパティ名

レスポンス

{
  "componentType": "Rigidbody",
  "propertyName": "mass",
  "value": 1.0,
  "propertyType": "float"
}

Clone this wiki locally