/// <summary>
        /// Print a <see cref="Settings"/> object.
        /// </summary>
        /// <param name="settings">The asset bundles settings object.</param>
        /// <param name="title">The title.</param>
        private static void PrintSettings(BuildAssetBundlesSettings settings, string title = null)
        {
            var stringBuilder = new StringBuilder();

            stringBuilder.AppendLine(UnityCommandLine.Values.SEPARATOR);
            if (!string.IsNullOrEmpty(title))
            {
                stringBuilder.AppendLine(title);
            }
            BuildAssetBundlesSettings.Print(settings, stringBuilder);
            stringBuilder.AppendLine(UnityCommandLine.Values.SEPARATOR);

            PrintLine(stringBuilder.ToString());
        }
Esempio n. 2
0
        /// <summary>
        /// Prints the values of a <see cref="BuildAssetBundlesSettings"/> instance.
        /// </summary>
        /// <param name="settings">The build asset bundles settings instance.</param>
        /// <param name="stringBuilder">The string builder instance.</param>
        public static void Print(BuildAssetBundlesSettings settings, StringBuilder stringBuilder)
        {
            if (!string.IsNullOrEmpty(settings.OutputPath))
            {
                stringBuilder.AppendLine(string.Format("OutputPath: {0}", settings.OutputPath));
            }

            if (settings.Options != BuildAssetBundleOptions.None)
            {
                stringBuilder.AppendLine(string.Format("Options: {0}", settings.Options));
            }

            stringBuilder.AppendLine(string.Format("TargetPlatform: {0}", settings.TargetPlatform));
        }
        /// <summary>
        /// Creates an instance of <see cref="BuildAssetBundlesCommandBase"/>.
        /// </summary>
        public BuildAssetBundlesCommandBase()
        {
            Settings = new BuildAssetBundlesSettings();

            // Gets the build target string.
            string buildTargetString;

            if (!GetArgumentValue(Values.ARG_BUILD_TARGET, out buildTargetString))
            {
                throw new Exception(string.Format("Argument '{0}' is required.", Values.ARG_BUILD_TARGET));
            }

            var buildTarget = buildTargetString.ToBuildTarget();

            // Sets the build target.
            Settings.TargetPlatform = buildTarget;

            var targetGroup = BuildTargetUtils.GetBuildTargetGroup(Settings.TargetPlatform);

            if (!IsBuildTargetSupported(targetGroup, Settings.TargetPlatform))
            {
                throw new Exception(string.Format("Build target '{0}' is not supported on this editor.", Settings.TargetPlatform));
            }
        }
 /// <summary>
 /// Builds asset bundles.
 /// </summary>
 /// <param name="settings">The build asset bundles settings.</param>
 /// <returns>The asset bundle manifest.</returns>
 private static AssetBundleManifest BuildAssetBundles(BuildAssetBundlesSettings settings)
 {
     return(UBuildPipeline.BuildAssetBundles(settings.OutputPath, settings.Options, settings.TargetPlatform));
 }