cocos_add_sliced_sprite
Add a sliced sprite to Cocos Creator scenes for scalable UI elements. This tool attaches a 9-slice sprite that stretches its center while preserving corners, enabling flexible resizing of buttons, panels, and backgrounds.
Instructions
Attach cc.Sprite with type=SLICED (9-slice). Stretches center, keeps corners.
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_sliced_sprite"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scene_path | Yes | ||
| node_id | Yes | ||
| sprite_frame_uuid | No | ||
| color_r | No | ||
| color_g | No | ||
| color_b | No | ||
| color_a | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |