AGENT SKILL
C# 脚本文件更新与创建
script-update-or-create
使用所提供的 C# 代码更新或创建脚本文件。结束时执行 AssetDatabase.Refresh()。如果代码存在语法错误,则提供编译错误的详细信息。使用 'script-read' 工具先读取已有的脚本文件。
- License 许可
- MIT
- 最近更新
- 2026-04-12
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- script-update-or-create
- description
- 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.
02 资源文件 4
- 参考文档README.md2.8 KB
- 脚本scripts/main.py7.1 KB
- 参考文档SOURCE.md367 B
- 参考文档TRUST.auto.yaml2.1 KB
03 SKILL.md 正文
Script / Update or Create
How to Call
unity-mcp-cli run-tool script-update-or-create --input '{
"filePath": "string_value",
"content": "string_value"
}'
For complex input (multi-line strings, code), save the JSON to a file and use:
unity-mcp-cli run-tool script-update-or-create --input-file args.jsonOr pipe via stdin (recommended):
unity-mcp-cli run-tool script-update-or-create --input-file - <<'EOF' {"param": "value"} EOF
Troubleshooting
If unity-mcp-cli is not found, either install it globally (npm install -g unity-mcp-cli) or use npx unity-mcp-cli instead.
Read the /unity-initial-setup skill for detailed installation instructions.
Input
| Name | Type | Required | Description |
|---|---|---|---|
filePath |
string |
Yes | The path to the file. Sample: "Assets/Scripts/MyScript.cs". |
content |
string |
Yes | C# code - content of the file. |
Input JSON Schema
{
"type": "object",
"properties": {
"filePath": {
"type": "string"
},
"content": {
"type": "string"
}
},
"required": [
"filePath",
"content"
]
}
Output
This tool does not return structured output.