cocos_add_widget
Attach a widget component to Cocos Creator nodes for screen-anchor layout using bitmask alignment flags, enabling precise UI positioning without manual coding.
Instructions
Attach a cc.Widget for screen-anchor layout. align_flags is a bitmask.
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>",
"node_id": "<node_id>"
},
"name": "cocos_add_widget"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scene_path | Yes | ||
| node_id | Yes | ||
| align_flags | No | ||
| target_id | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |