// ============================================================================================== #region private private static BuildPlayerOptions Generate_BuildPlayerOption(BuildConfig buildConfig) { BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions { scenes = buildConfig.buildSceneNames.Select(p => p += ".unity").ToArray(), locationPathName = buildConfig.GetBuildPath(), target = buildConfig.buildTarget, options = BuildOptions.None }; return(buildPlayerOptions); }
public static void Build(BuildConfig buildConfig) { BuildTargetGroup buildTargetGroup = BuildPipeline.GetBuildTargetGroup(buildConfig.buildTarget); BuildPlayerOptions buildPlayerOptions = Generate_BuildPlayerOption(buildConfig); PlayerSetting_Backup editorSetting_Backup = SettingBuildConfig_To_EditorSetting(buildConfig, buildTargetGroup); string overwriteConfigJson = Environment.GetEnvironmentVariable("overwrite"); if (string.IsNullOrEmpty(overwriteConfigJson) == false) { Debug.Log($"overwrite config : {overwriteConfigJson}"); JsonUtility.FromJsonOverwrite(overwriteConfigJson, buildConfig); } Dictionary <string, string> commandLine = new Dictionary <string, string>(); try { buildConfig.OnPreBuild(commandLine, ref buildPlayerOptions); BuildReport report = UnityEditor.BuildPipeline.BuildPlayer(buildPlayerOptions); buildConfig.OnPostBuild(commandLine); PrintBuildResult(buildConfig.GetBuildPath(), report); } catch (Exception e) { Debug.Log("Error - " + e); throw; } finally { editorSetting_Backup.Restore(); } Debug.Log($"After Build DefineSymbol Current {PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup)}"); // 2018.4 에서 프로젝트 전체 리임포팅 하는 이슈 대응 // https://issuetracker.unity3d.com/issues/osx-batchmode-build-hangs-at-refresh-detecting-if-any-assets-need-to-be-imported-or-removed #if UNITY_EDITOR AssetDatabase.Refresh(); #endif }