assets-prefab-create
Create a prefab from a GameObject in the active Unity scene. Specify the save path and source reference, and optionally replace the GameObject with the prefab.
Instructions
Create a prefab from a GameObject in the current active scene. The prefab will be saved in the project assets at the specified path. Use 'gameobject-find' tool to find the target GameObject first.
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": {
"prefabAssetPath": "<prefabAssetPath>",
"gameObjectRef": "<gameObjectRef>"
},
"name": "assets-prefab-create"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prefabAssetPath | Yes | Save path for the new prefab. Example: "Assets/Prefabs/MyPrefab.prefab" | |
| gameObjectRef | Yes | Source GameObject reference. SCHEMA: {"name":"ObjectName"} or {"instanceID":12345} or {"path":"hierarchy/path"} | |
| replaceGameObjectWithPrefab | No | If true, the prefab will replace the GameObject in the scene. | true |