cocos_create_node
Add a new node to Cocos Creator scenes for building game objects, then attach components like transforms and sprites to customize functionality.
Instructions
Append a new cc.Node under parent_id, return its array index.
layer defaults to UI_2D (33554432). Use 1073741824 for the camera node.
The new node has no components yet — call cocos_add_uitransform,
cocos_add_sprite etc. to attach them.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"scene_path": "<scene_path>",
"parent_id": "<parent_id>",
"name": "<name>"
},
"name": "cocos_create_node"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scene_path | Yes | ||
| parent_id | Yes | ||
| name | Yes | ||
| pos_x | No | ||
| pos_y | No | ||
| pos_z | No | ||
| scale | No | ||
| layer | No | ||
| active | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |