Ejemplo n.º 1
0
        public override void ResetSetting(BuildConfig buildConfig)
        {
            base.ResetSetting(buildConfig);

            BuildTargetGroup targetGroup = BuildPipeline.GetBuildTargetGroup(buildTarget);

            scriptingBackEnd       = PlayerSettings.GetScriptingBackend(targetGroup);
            bundleVersionCode      = PlayerSettings.Android.bundleVersionCode;
            buildConfig.buildPath +=
                "\n_{bundleVersion}.{bundleVersionCode}" +
                "\n_{scriptingBackEnd}";
        }
Ejemplo n.º 2
0
        // ==============================================================================================

        #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);
        }
Ejemplo n.º 3
0
        private static PlayerSetting_Backup SettingBuildConfig_To_EditorSetting(BuildConfig buildConfig, BuildTargetGroup buildTargetGroup)
        {
            string defineSymbol_Backup = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup);

            PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, buildConfig.defineSymbol);

            string productName_Backup = PlayerSettings.productName;

            PlayerSettings.productName = buildConfig.productName;

            return(new PlayerSetting_Backup(buildTargetGroup, defineSymbol_Backup, productName_Backup));
        }
Ejemplo n.º 4
0
        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
        }
 public abstract void ResetSetting(BuildConfig buildConfig);