Skip to content

Commit 8f227ff

Browse files
authored
Update .Bat file and Bug fix on ManageScript (#355)
* Update .Bat file and Bug fix on ManageScript * Update the .Bat file to include runtime folder * Fix the inconsistent EditorPrefs variable so the GUI change on Script Validation could cause real change. * Further changes String to Int for consistency
1 parent 0f506e4 commit 8f227ff

File tree

3 files changed

+23
-16
lines changed

3 files changed

+23
-16
lines changed

MCPForUnity/Editor/Tools/ManageScript.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,15 +1933,8 @@ string namespaceName
19331933
/// </summary>
19341934
private static ValidationLevel GetValidationLevelFromGUI()
19351935
{
1936-
string savedLevel = EditorPrefs.GetString("MCPForUnity_ScriptValidationLevel", "standard");
1937-
return savedLevel.ToLower() switch
1938-
{
1939-
"basic" => ValidationLevel.Basic,
1940-
"standard" => ValidationLevel.Standard,
1941-
"comprehensive" => ValidationLevel.Comprehensive,
1942-
"strict" => ValidationLevel.Strict,
1943-
_ => ValidationLevel.Standard // Default fallback
1944-
};
1936+
int savedLevel = EditorPrefs.GetInt("MCPForUnity.ValidationLevel", (int)ValidationLevel.Standard);
1937+
return (ValidationLevel)Mathf.Clamp(savedLevel, 0, 3);
19451938
}
19461939

19471940
/// <summary>

deploy-dev.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ set "SCRIPT_DIR=%~dp0"
1111
set "BRIDGE_SOURCE=%SCRIPT_DIR%MCPForUnity"
1212
set "SERVER_SOURCE=%SCRIPT_DIR%MCPForUnity\UnityMcpServer~\src"
1313
set "DEFAULT_BACKUP_DIR=%USERPROFILE%\Desktop\unity-mcp-backup"
14-
set "DEFAULT_SERVER_PATH=%LOCALAPPDATA%\Programs\UnityMCP\UnityMcpServer\src"
14+
set "DEFAULT_SERVER_PATH=%LOCALAPPDATA%\UnityMCP\UnityMcpServer\src"
1515

1616
:: Get user inputs
1717
echo Please provide the following paths:
1818
echo.
1919

2020
:: Package cache location
2121
echo Unity Package Cache Location:
22-
echo Example: X:\UnityProject\Library\PackageCache\com.coplaydev.unity-mcp@1.0.0
22+
echo Example: X:\Unity\Projects\UnityMCPTestbed2\Library\PackageCache\com.coplaydev.unity-mcp@4c106125b342
2323
set /p "PACKAGE_CACHE_PATH=Enter Unity package cache path: "
2424

2525
if "%PACKAGE_CACHE_PATH%"=="" (

restore-dev.bat

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ echo.
1111

1212
:: Configuration
1313
set "DEFAULT_BACKUP_DIR=%USERPROFILE%\Desktop\unity-mcp-backup"
14-
set "DEFAULT_SERVER_PATH=%LOCALAPPDATA%\Programs\UnityMCP\UnityMcpServer\src"
14+
set "DEFAULT_SERVER_PATH=%LOCALAPPDATA%\UnityMCP\UnityMcpServer\src"
1515

1616
:: Get user inputs
1717
echo Please provide the following paths:
@@ -102,7 +102,8 @@ echo ===============================================
102102
echo WARNING: This will overwrite current files!
103103
echo ===============================================
104104
echo Restoring from: %SELECTED_BACKUP%
105-
echo Unity Bridge target: %PACKAGE_CACHE_PATH%\Editor
105+
echo Unity Bridge Editor target: %PACKAGE_CACHE_PATH%\Editor
106+
echo Unity Bridge Runtime target: %PACKAGE_CACHE_PATH%\Runtime
106107
echo Python Server target: %SERVER_PATH%
107108
echo.
108109
set /p "confirm=Continue with restore? (y/N): "
@@ -119,16 +120,29 @@ echo ===============================================
119120

120121
:: Restore Unity Bridge
121122
if exist "%SELECTED_BACKUP%\UnityBridge\Editor" (
122-
echo Restoring Unity Bridge files...
123+
echo Restoring Unity Bridge Editor files...
123124
rd /s /q "%PACKAGE_CACHE_PATH%\Editor" 2>nul
124125
xcopy "%SELECTED_BACKUP%\UnityBridge\Editor\*" "%PACKAGE_CACHE_PATH%\Editor\" /E /I /Y > nul
125126
if !errorlevel! neq 0 (
126-
echo Error: Failed to restore Unity Bridge files
127+
echo Error: Failed to restore Unity Bridge Editor files
127128
pause
128129
exit /b 1
129130
)
130131
) else (
131-
echo Warning: No Unity Bridge backup found, skipping...
132+
echo Warning: No Unity Bridge Editor backup found, skipping...
133+
)
134+
135+
if exist "%SELECTED_BACKUP%\UnityBridge\Runtime" (
136+
echo Restoring Unity Bridge Runtime files...
137+
rd /s /q "%PACKAGE_CACHE_PATH%\Runtime" 2>nul
138+
xcopy "%SELECTED_BACKUP%\UnityBridge\Runtime\*" "%PACKAGE_CACHE_PATH%\Runtime\" /E /I /Y > nul
139+
if !errorlevel! neq 0 (
140+
echo Error: Failed to restore Unity Bridge Runtime files
141+
pause
142+
exit /b 1
143+
)
144+
) else (
145+
echo Warning: No Unity Bridge Runtime backup found, skipping...
132146
)
133147

134148
:: Restore Python Server

0 commit comments

Comments
 (0)