示例#1
0
        private void OnGUI()
        {
            GUILayout.Label("Build halper", HalperGuiStyle.getWinTitle());

            DataBuildSettingsBridge bridge = BuildHelperBase.getScriptableDataBuildSettings();
            DataBuildSettingProfile cur    = bridge.getPlatformProfil();

            GUILayout.Label("platform : " + cur.getPlatformTarget());

            GUILayout.BeginHorizontal();
            GUILayout.Label("zip name :");
            GUILayout.TextArea(cur.getZipName());
            GUILayout.EndHorizontal();
        }
示例#2
0
        protected void build_app()
        {
            // https://docs.unity3d.com/ScriptReference/Build.Reporting.BuildSummary.html

            DataBuildSettingProfile profile = data.getPlatformProfil();

            BuildReport  report  = BuildPipeline.BuildPlayer(buildPlayerOptions);
            BuildSummary summary = report.summary;

            if (summary.result == BuildResult.Succeeded)
            {
                onSuccess(summary, (profile.openFolderOnBuildSuccess || open_on_sucess));
            }

            if (summary.result == BuildResult.Failed)
            {
                Debug.LogError("Build failed");
            }
        }
示例#3
0
        static public void applySettings(DataBuildSettingProfile profil)
        {
            if (profil == null)
            {
                Debug.LogError("no profil ?");
                return;
            }

            BuildTarget bt = UnityEditor.EditorUserBuildSettings.activeBuildTarget;

            //if (bt == null) Debug.LogError("no build target ?");

            Debug.Log("applying profile : <b>" + profil.name + "</b> | current platform ? " + bt);

            Debug.Log("//Globals//");

            profil.version.applyCurrent(); // apply version

            PlayerSettings.companyName = profil.compagny_name;
            Debug.Log("  L companyName : " + PlayerSettings.companyName);

            //α,β,Ω
            string productName = profil.getProductName();

            if (profil.phase != BuildPhase.none && profil.phase != BuildPhase.Ω)
            {
                productName += "(" + profil.phase + ")";
            }
            PlayerSettings.productName = productName;
            Debug.Log("  L productName : " + PlayerSettings.productName);

            //TODO mobile
            //PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, profil.package_name);
            //PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.iOS, profil.package_name);

            Debug.Log("~Systems~");

            DataBuildSettingProfileMobile pMobile = profil as DataBuildSettingProfileMobile;

            if (pMobile != null)
            {
                PlayerSettings.defaultInterfaceOrientation = pMobile.orientation_default;

                PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, pMobile.getPackageName());
            }

            Texture2D[] icons = new Texture2D[1];
            icons[0] = profil.icon;

            PlayerSettings.SetIconsForTargetGroup(BuildTargetGroup.Unknown, icons);

            Debug.Log("  L updated icons");

            PlayerSettings.SplashScreen.show = false;
            //PlayerSettings.SplashScreen.background = data.splashscreen;
            //PlayerSettings.SplashScreenLogo.unityLogo = data.splashscreen;
            //PlayerSettings.SplashScreenLogo.unityLogo = data.splashscreen;
            Debug.Log("  L updated splash");

            //dev build
#if UNITY_EDITOR
            UnityEditor.EditorUserBuildSettings.development = profil.developement_build;

            DataBuildSettingProfileSwitch pSwitch = profil as DataBuildSettingProfileSwitch;
            if (pSwitch != null)
            {
                EditorUserBuildSettings.switchCreateRomFile = pSwitch.build_rom;
            }
#endif

            //android specific
            DataBuildSettingProfileAndroid pAndroid = profil as DataBuildSettingProfileAndroid;
            if (pAndroid != null)
            {
                PlayerSettings.Android.minSdkVersion = pAndroid.minSdk;
                Debug.Log("  L updated android stuff");
            }

            DataBuildSettingProfileIos pIos = profil as DataBuildSettingProfileIos;
            if (pIos != null)
            {
                //ios specific
                PlayerSettings.iOS.targetDevice          = pIos.target_device;
                PlayerSettings.iOS.targetOSVersionString = pIos.iOSVersion;
                Debug.Log("  L updated ios stuff");
            }

            //PlayerSettings.Android.name

            Debug.Log("~output~");
            Debug.Log("  L base path : " + profil.getBasePath());
            Debug.Log("  L build name : " + profil.getBuildFullName(true));
        }
示例#4
0
        static public void applySettings()
        {
            DataBuildSettingProfile data = getActiveProfile();

            applySettings(data);
        }
示例#5
0
        protected void build_prep()
        {
            if (BuildPipeline.isBuildingPlayer)
            {
                return;
            }

            Debug.Log("now building app ; inc version ? " + version_increment);

            buildPlayerOptions = new BuildPlayerOptions();

            DataBuildSettingProfile profile = data.getPlatformProfil();

            if (profile == null)
            {
                Debug.LogError("no profile for current platform ?");
                return;
            }

            profile.apply();

            //DataBuildSettingProfileAndroid pAndroid = profile as DataBuildSettingProfileAndroid;
            //DataBuildSettingProfileIos pIos = profile as DataBuildSettingProfileIos;
            //DataBuildSettingProfileWindows pWindows = profile as DataBuildSettingProfileWindows;
            //DataBuildSettingProfileSwitch pSwitch = profile as DataBuildSettingProfileSwitch;

            //this will apply
            if (version_increment)
            {
                DataBuildSettingVersion v = HalperScriptables.getScriptableObjectInEditor <DataBuildSettingVersion>("version");
                v.incrementFix();
            }

            //apply everything (after inc)
            applySettings(profile);

            //buildPlayerOptions.scenes = new[] { "Assets/Scene1.unity", "Assets/Scene2.unity" };
            buildPlayerOptions.scenes = getScenePaths();
            //buildPlayerOptions.
            // === CREATE SOLVED BUILD PATH

            string absPath = profile.getBasePath();

            bool pathExists = Directory.Exists(absPath);

            if (!pathExists)
            {
                Directory.CreateDirectory(absPath);
                Debug.Log("  ... created : " + absPath);
            }

            // === INJECTING SOLVED PATH TO BUILD SETTINGS

            outputPath = absPath;

            //[project]_[version].[ext]
            absPath = Path.Combine(absPath, profile.getBuildFullName(true));

            Debug.Log("BuildHelper, saving build at : " + absPath);
            buildPlayerOptions.locationPathName = absPath;

            //will setup android or ios based on unity build settings target platform
            buildPlayerOptions.target = EditorUserBuildSettings.activeBuildTarget;

            if (profile.developement_build)
            {
                buildPlayerOptions.options |= BuildOptions.Development;
            }
            if (profile.scriptDebugging)
            {
                buildPlayerOptions.options |= BuildOptions.AllowDebugging;
            }
            if (auto_run)
            {
                buildPlayerOptions.options |= BuildOptions.AutoRunPlayer;
            }

            //BuildPipeline.BuildPlayer(buildPlayerOptions);
        }