Skip to content

Commit b179ce1

Browse files
authored
Merge branch 'main' into feat/bridge-stability
2 parents 97614e7 + 22ca5a7 commit b179ce1

File tree

5 files changed

+52
-51
lines changed

5 files changed

+52
-51
lines changed

.github/FUNDING.yml

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

README-DEV.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ X:\UnityProject\Library\PackageCache\com.coplaydev.unity-mcp@<version-or-hash>
5353
Example (hash):
5454
```
5555
X:\UnityProject\Library\PackageCache\com.coplaydev.unity-mcp@272123cfd97e
56+
5657
```
5758

5859
To find it reliably:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ Connect your MCP Client (Claude, Cursor, etc.) to the Python server you installe
126126
2. Click `Auto-Setup`.
127127
3. Look for a green status indicator 🟢 and "Connected ✓". *(This attempts to modify the MCP Client\'s config file automatically)*.
128128

129+
129130
**Option B: Manual Configuration**
130131

131132
If Auto-Setup fails or you use a different client:

UnityMcpBridge/Editor/Helpers/ServerInstaller.cs

Lines changed: 49 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public static class ServerInstaller
1010
{
1111
private const string RootFolder = "UnityMCP";
1212
private const string ServerFolder = "UnityMcpServer";
13+
1314
/// <summary>
1415
/// Ensures the unity-mcp-server is installed locally by copying from the embedded package source.
1516
/// No network calls or Git operations are performed.
@@ -135,45 +136,58 @@ private static bool TryGetEmbeddedServerSource(out string srcPath)
135136
catch { /* ignore */ }
136137

137138
// 2) Installed package: resolve via Package Manager
138-
try
139+
// 2) Installed package: resolve via Package Manager (support new + legacy IDs, warn on legacy)
140+
try
141+
{
142+
var list = UnityEditor.PackageManager.Client.List();
143+
while (!list.IsCompleted) { }
144+
if (list.Status == UnityEditor.PackageManager.StatusCode.Success)
145+
{
146+
const string CurrentId = "com.coplaydev.unity-mcp";
147+
const string LegacyId = "com.justinpbarnett.unity-mcp";
148+
149+
foreach (var pkg in list.Result)
150+
{
151+
if (pkg.name == CurrentId || pkg.name == LegacyId)
139152
{
140-
var list = UnityEditor.PackageManager.Client.List();
141-
while (!list.IsCompleted) { }
142-
if (list.Status == UnityEditor.PackageManager.StatusCode.Success)
153+
if (pkg.name == LegacyId)
143154
{
144-
foreach (var pkg in list.Result)
145-
{
146-
if (pkg.name == "com.justinpbarnett.unity-mcp")
147-
{
148-
string packagePath = pkg.resolvedPath; // e.g., Library/PackageCache/... or local path
149-
150-
// Preferred: UnityMcpServer~ embedded alongside Editor/Runtime within the package (ignored by Unity import)
151-
string embeddedTilde = Path.Combine(packagePath, "UnityMcpServer~", "src");
152-
if (Directory.Exists(embeddedTilde) && File.Exists(Path.Combine(embeddedTilde, "server.py")))
153-
{
154-
srcPath = embeddedTilde;
155-
return true;
156-
}
157-
158-
// Fallback: legacy non-tilde folder name inside the package
159-
string embedded = Path.Combine(packagePath, "UnityMcpServer", "src");
160-
if (Directory.Exists(embedded) && File.Exists(Path.Combine(embedded, "server.py")))
161-
{
162-
srcPath = embedded;
163-
return true;
164-
}
165-
166-
// Legacy: sibling of the package folder (dev-linked). Only valid when present on disk.
167-
string sibling = Path.Combine(Path.GetDirectoryName(packagePath) ?? string.Empty, "UnityMcpServer", "src");
168-
if (Directory.Exists(sibling) && File.Exists(Path.Combine(sibling, "server.py")))
169-
{
170-
srcPath = sibling;
171-
return true;
172-
}
173-
}
174-
}
155+
Debug.LogWarning(
156+
"UnityMCP: Detected legacy package id 'com.justinpbarnett.unity-mcp'. " +
157+
"Please update Packages/manifest.json to 'com.coplaydev.unity-mcp' to avoid future breakage."
158+
);
159+
}
160+
161+
string packagePath = pkg.resolvedPath; // e.g., Library/PackageCache/... or local path
162+
163+
// Preferred: tilde folder embedded alongside Editor/Runtime within the package
164+
string embeddedTilde = Path.Combine(packagePath, "UnityMcpServer~", "src");
165+
if (Directory.Exists(embeddedTilde) && File.Exists(Path.Combine(embeddedTilde, "server.py")))
166+
{
167+
srcPath = embeddedTilde;
168+
return true;
169+
}
170+
171+
// Fallback: legacy non-tilde folder name inside the package
172+
string embedded = Path.Combine(packagePath, "UnityMcpServer", "src");
173+
if (Directory.Exists(embedded) && File.Exists(Path.Combine(embedded, "server.py")))
174+
{
175+
srcPath = embedded;
176+
return true;
177+
}
178+
179+
// Legacy: sibling of the package folder (dev-linked). Only valid when present on disk.
180+
string sibling = Path.Combine(Path.GetDirectoryName(packagePath) ?? string.Empty, "UnityMcpServer", "src");
181+
if (Directory.Exists(sibling) && File.Exists(Path.Combine(sibling, "server.py")))
182+
{
183+
srcPath = sibling;
184+
return true;
175185
}
176186
}
187+
}
188+
}
189+
}
190+
177191
catch { /* ignore */ }
178192

179193
// 3) Fallback to previous common install locations

UnityMcpBridge/Editor/Windows/UnityMcpEditorWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ private string FindPackagePythonDirectory()
996996
{
997997
foreach (UnityEditor.PackageManager.PackageInfo package in request.Result)
998998
{
999-
if (package.name == "com.justinpbarnett.unity-mcp")
999+
if (package.name == "com.coplaydev.unity-mcp")
10001000
{
10011001
string packagePath = package.resolvedPath;
10021002

0 commit comments

Comments
 (0)