-
Notifications
You must be signed in to change notification settings - Fork 1
Component API
Daisuke Tsukada edited this page Dec 19, 2025
·
1 revision
コンポーネント操作に関する API です。
| API | 説明 |
|---|---|
unity.component.add |
コンポーネントを追加 |
unity.component.remove |
コンポーネントを削除 |
unity.component.get |
コンポーネント情報を取得 |
unity.component.list |
オブジェクトのコンポーネント一覧 |
unity.component.setProperty |
プロパティを設定 |
unity.component.getProperty |
プロパティを取得 |
GameObject にコンポーネントを追加します。
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
path |
string | Yes | オブジェクトのパス |
componentType |
string | Yes | コンポーネント型名(例: "Rigidbody", "BoxCollider") |
{
"success": true,
"componentType": "Rigidbody",
"gameObjectPath": "/Player"
}コンポーネントを削除します。
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
path |
string | Yes | オブジェクトのパス |
componentType |
string | Yes | 削除するコンポーネント型名 |
{
"success": true,
"removed": "Rigidbody"
}オブジェクトにアタッチされているコンポーネント一覧を取得します。
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
path |
string | Yes | オブジェクトのパス |
{
"gameObjectPath": "/Player",
"components": [
"Transform",
"MeshFilter",
"MeshRenderer",
"Rigidbody",
"BoxCollider"
]
}コンポーネントのプロパティを設定します。
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
path |
string | Yes | オブジェクトのパス |
componentType |
string | Yes | コンポーネント型名 |
propertyName |
string | Yes | プロパティ名 |
value |
any | Yes | 設定する値 |
{
"success": true,
"componentType": "Rigidbody",
"propertyName": "mass",
"newValue": 10.0
}コンポーネントのプロパティ値を取得します。
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
path |
string | Yes | オブジェクトのパス |
componentType |
string | Yes | コンポーネント型名 |
propertyName |
string | Yes | プロパティ名 |
{
"componentType": "Rigidbody",
"propertyName": "mass",
"value": 1.0,
"propertyType": "float"
}