Skip to content

Commit 85202d4

Browse files
committed
fix(editor): only treat dev mode when manifest uses file: path for package; remove dev-mode logs under UPM
1 parent 5759201 commit 85202d4

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

UnityMcpBridge/Editor/Windows/UnityMcpEditorWindow.cs

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -945,32 +945,23 @@ private bool IsDevelopmentMode()
945945
{
946946
try
947947
{
948-
// Check if we're using a file-based package by looking at the manifest
948+
// Only treat as development if manifest explicitly references a local file path for the package
949949
string manifestPath = Path.Combine(Application.dataPath, "..", "Packages", "manifest.json");
950-
if (File.Exists(manifestPath))
951-
{
952-
string manifestContent = File.ReadAllText(manifestPath);
953-
// Look for file-based package reference
954-
if (manifestContent.Contains("file:/") && manifestContent.Contains("unity-mcp"))
955-
{
956-
return true;
957-
}
958-
}
959-
960-
// Also check if we're in a development environment by looking for common dev paths
961-
string[] devIndicators = {
962-
Path.Combine(Application.dataPath, "..", "unity-mcp"),
963-
Path.Combine(Application.dataPath, "..", "..", "unity-mcp"),
964-
};
965-
966-
foreach (string indicator in devIndicators)
950+
if (!File.Exists(manifestPath)) return false;
951+
952+
string manifestContent = File.ReadAllText(manifestPath);
953+
// Look specifically for our package dependency set to a file: URL
954+
// This avoids auto-enabling dev mode just because a repo exists elsewhere on disk
955+
if (manifestContent.IndexOf("\"com.justinpbarnett.unity-mcp\"", StringComparison.OrdinalIgnoreCase) >= 0)
967956
{
968-
if (Directory.Exists(indicator) && File.Exists(Path.Combine(indicator, "UnityMcpServer", "src", "server.py")))
957+
int idx = manifestContent.IndexOf("com.justinpbarnett.unity-mcp", StringComparison.OrdinalIgnoreCase);
958+
// Crude but effective: check for "file:" in the same line/value
959+
if (manifestContent.IndexOf("file:", idx, StringComparison.OrdinalIgnoreCase) >= 0
960+
&& manifestContent.IndexOf("\n", idx, StringComparison.OrdinalIgnoreCase) > manifestContent.IndexOf("file:", idx, StringComparison.OrdinalIgnoreCase))
969961
{
970962
return true;
971963
}
972964
}
973-
974965
return false;
975966
}
976967
catch

0 commit comments

Comments
 (0)