Skip to content

Commit d76e2b1

Browse files
committed
refactor: remove manual domain reload tool
- Removed reload_domain tool as Unity handles script recompilation automatically - Updated documentation to reflect automatic compilation workflow - Simplified script management workflow instructions in server description
1 parent 730092d commit d76e2b1

File tree

4 files changed

+11
-34
lines changed

4 files changed

+11
-34
lines changed

README-zh.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ MCP for Unity 作为桥梁,允许 AI 助手(如 Claude、Cursor)通过本
4646
* `manage_script`: 管理 C# 脚本(创建、读取、更新、删除)。
4747
* `manage_shader`: 执行着色器 CRUD 操作(创建、读取、修改、删除)。
4848
* `read_console`: 获取控制台消息或清除控制台。
49-
* `reload_domain`: 重新加载 Unity 域。
5049
* `run_test`: 在 Unity 编辑器中运行测试。
5150
* `apply_text_edits`: 具有前置条件哈希和原子多编辑批次的精确文本编辑。
5251
* `script_apply_edits`: 结构化 C# 方法/类编辑(插入/替换/删除),具有更安全的边界。

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ MCP for Unity acts as a bridge, allowing AI assistants (like Claude, Cursor) to
4848
* `manage_script`: Manages C# scripts (create, read, update, delete).
4949
* `manage_shader`: Performs shader CRUD operations (create, read, modify, delete).
5050
* `read_console`: Gets messages from or clears the console.
51-
* `reload_domain`: Reloads the Unity domain.
5251
* `run_test`: Runs a tests in the Unity Editor.
5352
* `set_active_instance`: Routes subsequent tool calls to a specific Unity instance (when multiple are running).
5453
* `apply_text_edits`: Precise text edits with precondition hashes and atomic multi-edit batches.

Server/server.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,14 @@ def _emit_startup():
108108
instances = _unity_connection_pool.discover_all_instances()
109109

110110
if instances:
111-
logger.info(f"Discovered {len(instances)} Unity instance(s): {[i.id for i in instances]}")
111+
logger.info(
112+
f"Discovered {len(instances)} Unity instance(s): {[i.id for i in instances]}")
112113

113114
# Try to connect to default instance
114115
try:
115116
_unity_connection_pool.get_connection()
116-
logger.info("Connected to default Unity instance on startup")
117+
logger.info(
118+
"Connected to default Unity instance on startup")
117119

118120
# Record successful Unity connection (deferred)
119121
import threading as _t
@@ -126,7 +128,8 @@ def _emit_startup():
126128
}
127129
)).start()
128130
except Exception as e:
129-
logger.warning("Could not connect to default Unity instance: %s", e)
131+
logger.warning(
132+
"Could not connect to default Unity instance: %s", e)
130133
else:
131134
logger.warning("No Unity instances found on startup")
132135

@@ -177,10 +180,9 @@ def _emit_startup():
177180
Important Workflows:
178181
179182
Script Management:
180-
1. After creating or modifying scripts with `manage_script`, ALWAYS call `reload_domain` immediately
181-
2. Wait for Unity to recompile (domain reload is asynchronous)
182-
3. Use `read_console` to check for compilation errors before proceeding
183-
4. Only after successful compilation can new components/types be used
183+
1. After creating or modifying scripts with `manage_script`
184+
2. Use `read_console` to check for compilation errors before proceeding
185+
3. Only after successful compilation can new components/types be used
184186
185187
Scene Setup:
186188
- Always include a Camera and main Light (Directional Light) in new scenes
@@ -246,7 +248,8 @@ def main():
246248
# Set environment variable if --default-instance is provided
247249
if args.default_instance:
248250
os.environ["UNITY_MCP_DEFAULT_INSTANCE"] = args.default_instance
249-
logger.info(f"Using default Unity instance from command-line: {args.default_instance}")
251+
logger.info(
252+
f"Using default Unity instance from command-line: {args.default_instance}")
250253

251254
mcp.run(transport='stdio')
252255

Server/tools/reload_domain.py

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)