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
main
Shutong Wu 2025-10-25 12:27:07 -04:00 committed by GitHub
parent 0f506e4bee
commit 8f227ff5be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 16 deletions

View File

@ -1933,15 +1933,8 @@ namespace MCPForUnity.Editor.Tools
/// </summary>
private static ValidationLevel GetValidationLevelFromGUI()
{
string savedLevel = EditorPrefs.GetString("MCPForUnity_ScriptValidationLevel", "standard");
return savedLevel.ToLower() switch
{
"basic" => ValidationLevel.Basic,
"standard" => ValidationLevel.Standard,
"comprehensive" => ValidationLevel.Comprehensive,
"strict" => ValidationLevel.Strict,
_ => ValidationLevel.Standard // Default fallback
};
int savedLevel = EditorPrefs.GetInt("MCPForUnity.ValidationLevel", (int)ValidationLevel.Standard);
return (ValidationLevel)Mathf.Clamp(savedLevel, 0, 3);
}
/// <summary>

View File

@ -11,7 +11,7 @@ set "SCRIPT_DIR=%~dp0"
set "BRIDGE_SOURCE=%SCRIPT_DIR%MCPForUnity"
set "SERVER_SOURCE=%SCRIPT_DIR%MCPForUnity\UnityMcpServer~\src"
set "DEFAULT_BACKUP_DIR=%USERPROFILE%\Desktop\unity-mcp-backup"
set "DEFAULT_SERVER_PATH=%LOCALAPPDATA%\Programs\UnityMCP\UnityMcpServer\src"
set "DEFAULT_SERVER_PATH=%LOCALAPPDATA%\UnityMCP\UnityMcpServer\src"
:: Get user inputs
echo Please provide the following paths:
@ -19,7 +19,7 @@ echo.
:: Package cache location
echo Unity Package Cache Location:
echo Example: X:\UnityProject\Library\PackageCache\com.coplaydev.unity-mcp@1.0.0
echo Example: X:\Unity\Projects\UnityMCPTestbed2\Library\PackageCache\com.coplaydev.unity-mcp@4c106125b342
set /p "PACKAGE_CACHE_PATH=Enter Unity package cache path: "
if "%PACKAGE_CACHE_PATH%"=="" (

View File

@ -11,7 +11,7 @@ echo.
:: Configuration
set "DEFAULT_BACKUP_DIR=%USERPROFILE%\Desktop\unity-mcp-backup"
set "DEFAULT_SERVER_PATH=%LOCALAPPDATA%\Programs\UnityMCP\UnityMcpServer\src"
set "DEFAULT_SERVER_PATH=%LOCALAPPDATA%\UnityMCP\UnityMcpServer\src"
:: Get user inputs
echo Please provide the following paths:
@ -102,7 +102,8 @@ echo ===============================================
echo WARNING: This will overwrite current files!
echo ===============================================
echo Restoring from: %SELECTED_BACKUP%
echo Unity Bridge target: %PACKAGE_CACHE_PATH%\Editor
echo Unity Bridge Editor target: %PACKAGE_CACHE_PATH%\Editor
echo Unity Bridge Runtime target: %PACKAGE_CACHE_PATH%\Runtime
echo Python Server target: %SERVER_PATH%
echo.
set /p "confirm=Continue with restore? (y/N): "
@ -119,16 +120,29 @@ echo ===============================================
:: Restore Unity Bridge
if exist "%SELECTED_BACKUP%\UnityBridge\Editor" (
echo Restoring Unity Bridge files...
echo Restoring Unity Bridge Editor files...
rd /s /q "%PACKAGE_CACHE_PATH%\Editor" 2>nul
xcopy "%SELECTED_BACKUP%\UnityBridge\Editor\*" "%PACKAGE_CACHE_PATH%\Editor\" /E /I /Y > nul
if !errorlevel! neq 0 (
echo Error: Failed to restore Unity Bridge files
echo Error: Failed to restore Unity Bridge Editor files
pause
exit /b 1
)
) else (
echo Warning: No Unity Bridge backup found, skipping...
echo Warning: No Unity Bridge Editor backup found, skipping...
)
if exist "%SELECTED_BACKUP%\UnityBridge\Runtime" (
echo Restoring Unity Bridge Runtime files...
rd /s /q "%PACKAGE_CACHE_PATH%\Runtime" 2>nul
xcopy "%SELECTED_BACKUP%\UnityBridge\Runtime\*" "%PACKAGE_CACHE_PATH%\Runtime\" /E /I /Y > nul
if !errorlevel! neq 0 (
echo Error: Failed to restore Unity Bridge Runtime files
pause
exit /b 1
)
) else (
echo Warning: No Unity Bridge Runtime backup found, skipping...
)
:: Restore Python Server