[fix] 修复macOS下的编译bug

main
walon 2022-12-16 11:23:37 +08:00
parent 0e04a66c91
commit 00cedc166f
1 changed files with 27 additions and 5 deletions

View File

@ -40,7 +40,11 @@ namespace HybridCLR.Editor.Commands
var buildOptions = BuildOptions.BuildScriptsOnly; var buildOptions = BuildOptions.BuildScriptsOnly;
bool oldExportAndroidProj = EditorUserBuildSettings.exportAsGoogleAndroidProject; bool oldExportAndroidProj = EditorUserBuildSettings.exportAsGoogleAndroidProject;
bool oldCreateSolutionWin = UnityEditor.WindowsStandalone.UserBuildSettings.createSolution; #if UNITY_EDITOR_OSX
bool oldCreateSolution = UnityEditor.OSXStandalone.UserBuildSettings.createXcodeProject;
#elif UNITY_EDITOR_WIN
bool oldCreateSolution = UnityEditor.WindowsStandalone.UserBuildSettings.createSolution;
#endif
bool oldBuildScriptsOnly = EditorUserBuildSettings.buildScriptsOnly; bool oldBuildScriptsOnly = EditorUserBuildSettings.buildScriptsOnly;
EditorUserBuildSettings.buildScriptsOnly = true; EditorUserBuildSettings.buildScriptsOnly = true;
@ -49,7 +53,16 @@ namespace HybridCLR.Editor.Commands
case BuildTarget.StandaloneWindows: case BuildTarget.StandaloneWindows:
case BuildTarget.StandaloneWindows64: case BuildTarget.StandaloneWindows64:
{ {
#if UNITY_EDITOR_WIN
UnityEditor.WindowsStandalone.UserBuildSettings.createSolution = true; UnityEditor.WindowsStandalone.UserBuildSettings.createSolution = true;
#endif
break;
}
case BuildTarget.StandaloneOSX:
{
#if UNITY_EDITOR_OSX
UnityEditor.OSXStandalone.UserBuildSettings.createXcodeProject = true;
#endif
break; break;
} }
case BuildTarget.Android: case BuildTarget.Android:
@ -75,10 +88,19 @@ namespace HybridCLR.Editor.Commands
{ {
case BuildTarget.StandaloneWindows: case BuildTarget.StandaloneWindows:
case BuildTarget.StandaloneWindows64: case BuildTarget.StandaloneWindows64:
{ {
UnityEditor.WindowsStandalone.UserBuildSettings.createSolution = oldCreateSolutionWin; #if UNITY_EDITOR_WIN
break; UnityEditor.WindowsStandalone.UserBuildSettings.createSolution = oldCreateSolution;
} #endif
break;
}
case BuildTarget.StandaloneOSX:
{
#if UNITY_EDITOR_OSX
UnityEditor.OSXStandalone.UserBuildSettings.createXcodeProject = oldCreateSolution;
#endif
break;
}
case BuildTarget.Android: case BuildTarget.Android:
{ {
EditorUserBuildSettings.exportAsGoogleAndroidProject = oldExportAndroidProj; EditorUserBuildSettings.exportAsGoogleAndroidProject = oldExportAndroidProj;