Skip to content

Commit 9101105

Browse files
committed
Code Validation Update
1. Update the code validation feature. With Roslyn installed(see guide), MCP clients will receive detailed error messages and making the code generation process more error-proof 2. Minor update to the EditorWindow, making more space for upcoming features 3. Readme update to include Code validation guides 4. Minor bug fixes including installation bugs from previous VSC PR
1 parent 6906c24 commit 9101105

File tree

3 files changed

+992
-209
lines changed

3 files changed

+992
-209
lines changed

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,27 @@ Unity MCP connects your tools using two components:
7373
* [Cursor](https://www.cursor.com/en/downloads)
7474
* [Visual Studio Code Copilot](https://code.visualstudio.com/docs/copilot/overview)
7575
* *(Others may work with manual config)*
76+
* <details> <summary><strong>[Optional] Roslyn for Advanced Script Validation</strong></summary>
77+
78+
For **Strict** validation level that catches undefined namespaces, types, and methods:
79+
80+
**Method 1: NuGet for Unity (Recommended)**
81+
1. Install [NuGetForUnity](https://github.com/GlitchEnzo/NuGetForUnity)
82+
2. Go to `Window > NuGet Package Manager`
83+
3. Search for `Microsoft.CodeAnalysis.CSharp` and install the package
84+
5. Go to `Player Settings > Scripting Define Symbols`
85+
6. Add `USE_ROSLYN`
86+
7. Restart Unity
87+
88+
**Method 2: Manual DLL Installation**
89+
1. Download Microsoft.CodeAnalysis.CSharp.dll and dependencies from [NuGet](https://www.nuget.org/packages/Microsoft.CodeAnalysis.CSharp/)
90+
2. Place DLLs in `Assets/Plugins/` folder
91+
3. Ensure .NET compatibility settings are correct
92+
4. Add `USE_ROSLYN` to Scripting Define Symbols
93+
5. Restart Unity
94+
95+
**Note:** Without Roslyn, script validation falls back to basic structural checks. Roslyn enables full C# compiler diagnostics with precise error reporting.</details>
96+
7697

7798
### Step 1: Install the Unity Package (Bridge)
7899

@@ -192,7 +213,7 @@ If Auto-Configure fails or you use a different client:
192213

193214
### 🔴 High Priority
194215
- [ ] **Asset Generation Improvements** - Enhanced server request handling and asset pipeline optimization
195-
- [ ] **Code Generation Enhancements** - Improved generated code quality, validation, and error handling
216+
- [ ] **Code Generation Enhancements** - Improved generated code quality and error handling
196217
- [ ] **Robust Error Handling** - Comprehensive error messages, recovery mechanisms, and graceful degradation
197218
- [ ] **Remote Connection Support** - Enable seamless remote connection between Unity host and MCP server
198219
- [ ] **Documentation Expansion** - Complete tutorials for custom tool creation and API reference
@@ -210,6 +231,7 @@ If Auto-Configure fails or you use a different client:
210231
<summary><strong>✅ Completed Features<strong></summary>
211232

212233
- [x] **Shader Generation** - Generate shaders using CGProgram template
234+
- [x] **Advanced Script Validation** - Multi-level validation with semantic analysis, namespace/type checking, and Unity best practices (Will need Roslyn Installed, see [Prerequisite](#prerequisites)).
213235
</details>
214236

215237
### 🔬 Research & Exploration
@@ -295,4 +317,4 @@ Thanks to the contributors and the Unity team.
295317

296318
## Star History
297319

298-
[![Star History Chart](https://api.star-history.com/svg?repos=unity-mcp/unity-mcp,justinpbarnett/unity-mcp&type=Date)](https://www.star-history.com/#unity-mcp/unity-mcp&justinpbarnett/unity-mcp&Date)
320+
[![Star History Chart](https://api.star-history.com/svg?repos=justinpbarnett/unity-mcp&type=Date)](https://www.star-history.com/#justinpbarnett/unity-mcp&Date)

0 commit comments

Comments
 (0)