script-update-or-create
Update or create C# script files in Unity with automatic AssetDatabase.Refresh and compilation error reporting. Read existing scripts first using the script-read tool to avoid overwrites.
Instructions
Updates or creates script file with the provided C# code. Does AssetDatabase.Refresh() at the end. Provides compilation error details if the code has syntax errors. Use 'script-read' tool to read existing script files 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": {
"filePath": "<filePath>",
"content": "<content>"
},
"name": "script-update-or-create"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Path to the script file. Example: "Assets/Scripts/MyScript.cs" | |
| content | Yes | Full C# source code content for the file. | |
| requestId | No |