updated config path locator

main
Justin Barnett 2025-03-18 13:09:54 -04:00
parent 4144af2453
commit 20aa6839fe
1 changed files with 10 additions and 7 deletions

View File

@ -50,7 +50,10 @@ public static partial class UnityMCPBridge
{ {
try try
{ {
string configPath = Path.Combine(Application.dataPath, "MCPServer", "config.json"); // Get the directory of the current script
string scriptPath = Path.GetDirectoryName(typeof(UnityMCPBridge).Assembly.Location);
string configPath = Path.Combine(scriptPath, "..", "config.json");
if (File.Exists(configPath)) if (File.Exists(configPath))
{ {
string jsonConfig = File.ReadAllText(configPath); string jsonConfig = File.ReadAllText(configPath);
@ -59,7 +62,7 @@ public static partial class UnityMCPBridge
} }
else else
{ {
Debug.LogError("Server config file not found!"); Debug.LogError($"Server config file not found at: {configPath}");
serverConfig = new DefaultServerConfig(); serverConfig = new DefaultServerConfig();
} }
} }