fixed path issues

main
Justin Barnett 2025-03-18 13:36:22 -04:00
parent 4d1c351364
commit 46db62bfaa
4 changed files with 6 additions and 10 deletions

1
.gitignore vendored
View File

@ -9,6 +9,7 @@ CLAUDE.md
# Python-generated files
__pycache__/
__pycache__.meta
build/
dist/
wheels/

View File

@ -6,6 +6,7 @@ using System.Linq;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine.SceneManagement;
using UnityEditor.SceneManagement;
namespace MCPServer.Editor.Commands
{
@ -249,7 +250,7 @@ namespace MCPServer.Editor.Commands
public static object FindObjectsByName(JObject @params)
{
string name = (string)@params["name"] ?? throw new System.Exception("Parameter 'name' is required.");
var objects = GameObject.FindObjectsOfType<GameObject>()
var objects = GameObject.FindObjectsByType<GameObject>(FindObjectsSortMode.None)
.Where(o => o.name.Contains(name))
.Select(o => new
{

View File

@ -83,7 +83,6 @@ public class MCPEditorWindow : EditorWindow
private bool isUnityBridgeRunning = false;
private Vector2 scrollPosition;
private string claudeConfigStatus = "Not configured";
private bool isPythonServerConnected = false;
private string pythonServerStatus = "Not Connected";
private Color pythonServerStatusColor = Color.red;
private const int unityPort = 6400; // Hardcoded Unity port
@ -137,7 +136,6 @@ public class MCPEditorWindow : EditorWindow
if (await Task.WhenAny(readTask, Task.Delay(1000)) == readTask)
{
// Connection successful and responsive
isPythonServerConnected = true;
pythonServerStatus = "Connected";
pythonServerStatusColor = Color.green;
UnityEngine.Debug.Log($"Python server connected successfully on port {unityPort}");
@ -145,7 +143,6 @@ public class MCPEditorWindow : EditorWindow
else
{
// No response received
isPythonServerConnected = false;
pythonServerStatus = "No Response";
pythonServerStatusColor = Color.yellow;
UnityEngine.Debug.LogWarning($"Python server not responding on port {unityPort}");
@ -154,7 +151,6 @@ public class MCPEditorWindow : EditorWindow
catch (Exception e)
{
// Connection established but communication failed
isPythonServerConnected = false;
pythonServerStatus = "Communication Error";
pythonServerStatusColor = Color.yellow;
UnityEngine.Debug.LogWarning($"Error communicating with Python server: {e.Message}");
@ -163,7 +159,6 @@ public class MCPEditorWindow : EditorWindow
else
{
// Connection failed
isPythonServerConnected = false;
pythonServerStatus = "Not Connected";
pythonServerStatusColor = Color.red;
UnityEngine.Debug.LogWarning($"Python server is not running or not accessible on port {unityPort}");
@ -173,7 +168,6 @@ public class MCPEditorWindow : EditorWindow
}
catch (Exception e)
{
isPythonServerConnected = false;
pythonServerStatus = "Connection Error";
pythonServerStatusColor = Color.red;
UnityEngine.Debug.LogError($"Error checking Python server connection: {e.Message}");

View File

@ -33,7 +33,7 @@ Follow these simple steps to get started with the Unity MCP Server:
```bash
pip install uv
```
- Navigate to `Assets/unity-mcp/Python` in your project
- Navigate to `Python` in your project
- Install dependencies:
```bash
uv venv
@ -139,7 +139,7 @@ Encountering issues? Here are some common fixes:
- **Python Server Not Connected**
- Verify the Python server is running (`python server.py` in the `Python` directory).
- Check `config.json` (in `Assets/unity-mcp`) for correct port settings (default: `unity_port: 6400`, `mcp_port: 6500`).
- Check `config.json` for correct port settings (default: `unity_port: 6400`, `mcp_port: 6500`).
- Ensure `uv` and dependencies are installed correctly.
- **Configuration Issues with Claude Desktop or Cursor**