From b34e4c8cf7745394802657c1d1ad5e7b3a923306 Mon Sep 17 00:00:00 2001
From: Shutong Wu <51266340+Scriptwonder@users.noreply.github.com>
Date: Sun, 7 Dec 2025 19:36:44 -0500
Subject: [PATCH] [FEATURE] Batch Commands (#418)
* Update .Bat file and Bug fix on ManageScript
* Update the .Bat file to include runtime folder
* Fix the inconsistent EditorPrefs variable so the GUI change on Script Validation could cause real change.
* Further changes
String to Int for consistency
* [Custom Tool] Roslyn Runtime Compilation
Allows users to generate/compile codes during Playmode
* Fix based on CR
* Create claude_skill_unity.zip
Upload the unity_claude_skill that can be uploaded to Claude for a combo of unity-mcp-skill.
* Update for Custom_Tool Fix and Detection
1. Fix Original Roslyn Compilation Custom Tool to fit the V8 standard
2. Add a new panel in the GUI to see and toggle/untoggle the tools. The toggle feature will be implemented in the future, right now its implemented here to discuss with the team if this is a good feature to add;
3. Add few missing summary in certain tools
* Revert "Update for Custom_Tool Fix and Detection"
This reverts commit ae8cfe5e256c70ac4a16c79d50341a39cbac18ba.
* Update README.md
* Reapply "Update for Custom_Tool Fix and Detection"
This reverts commit f423c2f25e9ccff4f3b89d1d360ee9cf13143733.
* Update ManageScript.cs
Fix the layout problem of manage_script in the panel
* Update
To comply with the current server setting
* Update on Batch
Tested object generation/modification with batch and it works perfectly! We should push and let users test for a while and see
PS: I tried both VS Copilot and Claude Desktop. Claude Desktop works but VS Copilot does not due to the nested structure of batch. Will look into it more.
* Revert "Merge branch 'main' into batching"
This reverts commit 51fc4b4deb9e907cab3404d8c702131e3da85122, reversing
changes made to 318c824e1b78ca74701a1721a5a94f5dc567035f.
---
MCPForUnity/Editor/Tools/BatchExecute.cs | 205 ++++++++++++++++++
MCPForUnity/Editor/Tools/BatchExecute.cs.meta | 11 +
MCPForUnity/Editor/Tools/ManageAsset.cs | 4 +-
3 files changed, 219 insertions(+), 1 deletion(-)
create mode 100644 MCPForUnity/Editor/Tools/BatchExecute.cs
create mode 100644 MCPForUnity/Editor/Tools/BatchExecute.cs.meta
diff --git a/MCPForUnity/Editor/Tools/BatchExecute.cs b/MCPForUnity/Editor/Tools/BatchExecute.cs
new file mode 100644
index 0000000..fa46dd3
--- /dev/null
+++ b/MCPForUnity/Editor/Tools/BatchExecute.cs
@@ -0,0 +1,205 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+using MCPForUnity.Editor.Helpers;
+using Newtonsoft.Json.Linq;
+
+namespace MCPForUnity.Editor.Tools
+{
+ ///
+ /// Executes multiple MCP commands within a single Unity-side handler. Commands are executed sequentially
+ /// on the main thread to preserve determinism and Unity API safety.
+ ///
+ [McpForUnityTool("batch_execute", AutoRegister = false)]
+ public static class BatchExecute
+ {
+ private const int MaxCommandsPerBatch = 25;
+
+ public static async Task