Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="parameters"></param>
        public static void Build(AutomationParameters parameters)
        {
            var buildTarget = (BuildTarget)System.Enum.Parse(typeof(BuildTarget), parameters.Get("targetPlatform"));

            var scenesToBuild    = new HashSet <string>(EditorBuildSettings.scenes.Select(x => x.path));
            var additionalScenes = parameters.Get("scenesToBuild").Split(';');

            foreach (var scene in additionalScenes)
            {
                scenesToBuild.Add(scene);
            }

            var buildOptions = BuildOptions.None;

            if (parameters.Has("showBuiltPlayer"))
            {
                buildOptions |= BuildOptions.ShowBuiltPlayer;
            }

            var options = new BuildPlayerOptions
            {
                scenes           = scenesToBuild.ToArray(),
                target           = buildTarget,
                targetGroup      = BuildPipeline.GetBuildTargetGroup(buildTarget),
                locationPathName = parameters.Get("outputPath"),
                options          = buildOptions,
            };

            BuildPipeline.BuildPlayer(options);
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="parameters"></param>
        private static void CreateBuildInfo(AutomationParameters parameters)
        {
            var version = parameters.Get("buildVersion");
            var commit  = parameters.Get("buildCommit");

            var buildInfo = ScriptableObject.CreateInstance <BuildInfo>();

            buildInfo.version = version;
            buildInfo.commit  = commit;

            DeleteBuildInfo();
            UnityEditor.AssetDatabase.CreateAsset(buildInfo, BuildInfoAssetPath);
            UnityEditor.AssetDatabase.SaveAssets();

            Debug.Log($"Created BuildInfo file for version '{version}'.");
        }