Skip to content

Commit 46db62b

Browse files
fixed path issues
1 parent 4d1c351 commit 46db62b

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ CLAUDE.md
99

1010
# Python-generated files
1111
__pycache__/
12+
__pycache__.meta
1213
build/
1314
dist/
1415
wheels/

Editor/Commands/ObjectCommandHandler.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Collections.Generic;
77
using UnityEditor;
88
using UnityEngine.SceneManagement;
9+
using UnityEditor.SceneManagement;
910

1011
namespace MCPServer.Editor.Commands
1112
{
@@ -249,7 +250,7 @@ public static object GetComponentProperties(JObject @params)
249250
public static object FindObjectsByName(JObject @params)
250251
{
251252
string name = (string)@params["name"] ?? throw new System.Exception("Parameter 'name' is required.");
252-
var objects = GameObject.FindObjectsOfType<GameObject>()
253+
var objects = GameObject.FindObjectsByType<GameObject>(FindObjectsSortMode.None)
253254
.Where(o => o.name.Contains(name))
254255
.Select(o => new
255256
{
@@ -384,7 +385,7 @@ private static object BuildHierarchyNode(GameObject obj)
384385
.ToList()
385386
};
386387
}
387-
388+
388389
/// <summary>
389390
/// Creates a directional light game object
390391
/// </summary>

Editor/MCPEditorWindow.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ public class MCPEditorWindow : EditorWindow
8383
private bool isUnityBridgeRunning = false;
8484
private Vector2 scrollPosition;
8585
private string claudeConfigStatus = "Not configured";
86-
private bool isPythonServerConnected = false;
8786
private string pythonServerStatus = "Not Connected";
8887
private Color pythonServerStatusColor = Color.red;
8988
private const int unityPort = 6400; // Hardcoded Unity port
@@ -137,15 +136,13 @@ private async void CheckPythonServerConnection()
137136
if (await Task.WhenAny(readTask, Task.Delay(1000)) == readTask)
138137
{
139138
// Connection successful and responsive
140-
isPythonServerConnected = true;
141139
pythonServerStatus = "Connected";
142140
pythonServerStatusColor = Color.green;
143141
UnityEngine.Debug.Log($"Python server connected successfully on port {unityPort}");
144142
}
145143
else
146144
{
147145
// No response received
148-
isPythonServerConnected = false;
149146
pythonServerStatus = "No Response";
150147
pythonServerStatusColor = Color.yellow;
151148
UnityEngine.Debug.LogWarning($"Python server not responding on port {unityPort}");
@@ -154,7 +151,6 @@ private async void CheckPythonServerConnection()
154151
catch (Exception e)
155152
{
156153
// Connection established but communication failed
157-
isPythonServerConnected = false;
158154
pythonServerStatus = "Communication Error";
159155
pythonServerStatusColor = Color.yellow;
160156
UnityEngine.Debug.LogWarning($"Error communicating with Python server: {e.Message}");
@@ -163,7 +159,6 @@ private async void CheckPythonServerConnection()
163159
else
164160
{
165161
// Connection failed
166-
isPythonServerConnected = false;
167162
pythonServerStatus = "Not Connected";
168163
pythonServerStatusColor = Color.red;
169164
UnityEngine.Debug.LogWarning($"Python server is not running or not accessible on port {unityPort}");
@@ -173,7 +168,6 @@ private async void CheckPythonServerConnection()
173168
}
174169
catch (Exception e)
175170
{
176-
isPythonServerConnected = false;
177171
pythonServerStatus = "Connection Error";
178172
pythonServerStatusColor = Color.red;
179173
UnityEngine.Debug.LogError($"Error checking Python server connection: {e.Message}");

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Follow these simple steps to get started with the Unity MCP Server:
3333
```bash
3434
pip install uv
3535
```
36-
- Navigate to `Assets/unity-mcp/Python` in your project
36+
- Navigate to `Python` in your project
3737
- Install dependencies:
3838
```bash
3939
uv venv
@@ -139,7 +139,7 @@ Encountering issues? Here are some common fixes:
139139
- **Python Server Not Connected**
140140
141141
- Verify the Python server is running (`python server.py` in the `Python` directory).
142-
- Check `config.json` (in `Assets/unity-mcp`) for correct port settings (default: `unity_port: 6400`, `mcp_port: 6500`).
142+
- Check `config.json` for correct port settings (default: `unity_port: 6400`, `mcp_port: 6500`).
143143
- Ensure `uv` and dependencies are installed correctly.
144144
145145
- **Configuration Issues with Claude Desktop or Cursor**

0 commit comments

Comments
 (0)