LogBuildExceptionAndExit() private static method

private static LogBuildExceptionAndExit ( string buildFunctionName, Exception exception ) : void
buildFunctionName string
exception System.Exception
return void
        private static string BuildPlayer(string[] scenes, string locationPathName, string assetBundleManifestPath, BuildTarget target, BuildOptions options)
        {
            string result;

            if (string.IsNullOrEmpty(locationPathName))
            {
                if ((options & BuildOptions.InstallInBuildFolder) == BuildOptions.None || !PostprocessBuildPlayer.SupportsInstallInBuildFolder(target))
                {
                    result = "The 'locationPathName' parameter for BuildPipeline.BuildPlayer should not be null or empty.";
                    return(result);
                }
            }
            else if (string.IsNullOrEmpty(Path.GetFileName(locationPathName)))
            {
                string extensionForBuildTarget = PostprocessBuildPlayer.GetExtensionForBuildTarget(target, options);
                if (!string.IsNullOrEmpty(extensionForBuildTarget))
                {
                    result = string.Format("For the '{0}' target the 'locationPathName' parameter for BuildPipeline.BuildPlayer should not end with a directory separator.\nProvided path: '{1}', expected a path with the extension '.{2}'.", target, locationPathName, extensionForBuildTarget);
                    return(result);
                }
            }
            try
            {
                result = BuildPipeline.BuildPlayerInternal(scenes, locationPathName, assetBundleManifestPath, target, options).SummarizeErrors();
            }
            catch (Exception exception)
            {
                BuildPipeline.LogBuildExceptionAndExit("BuildPipeline.BuildPlayer", exception);
                result = "";
            }
            return(result);
        }
Beispiel #2
0
        private static string BuildPlayer(string[] scenes, string locationPathName, string assetBundleManifestPath, BuildTargetGroup buildTargetGroup, BuildTarget target, BuildOptions options)
        {
            string result;

            if (BuildPipeline.isBuildingPlayer)
            {
                result = "Cannot start a new build because there is already a build in progress.";
            }
            else
            {
                if (buildTargetGroup == BuildTargetGroup.Unknown)
                {
                    buildTargetGroup = BuildPipeline.GetBuildTargetGroup(target);
                }
                string text;
                if (!BuildPipeline.ValidateLocationPathNameForBuildTargetGroup(locationPathName, buildTargetGroup, target, options, out text))
                {
                    result = text;
                }
                else
                {
                    try
                    {
                        result = BuildPipeline.BuildPlayerInternal(scenes, locationPathName, assetBundleManifestPath, buildTargetGroup, target, options).SummarizeErrors();
                    }
                    catch (Exception exception)
                    {
                        BuildPipeline.LogBuildExceptionAndExit("BuildPipeline.BuildPlayer", exception);
                        result = "";
                    }
                }
            }
            return(result);
        }
Beispiel #3
0
        public static AssetBundleManifest BuildAssetBundles(string outputPath, AssetBundleBuild[] builds, [DefaultValue("BuildAssetBundleOptions.None")] BuildAssetBundleOptions assetBundleOptions, [DefaultValue("BuildTarget.WebPlayer")] BuildTarget targetPlatform)
        {
            if (!Directory.Exists(outputPath))
            {
                Debug.LogError("The output path \"" + outputPath + "\" doesn't exist");
                return(null);
            }
            if (builds == null)
            {
                Debug.LogError("AssetBundleBuild cannot be null.");
                return(null);
            }
            AssetBundleManifest result;

            try
            {
                result = BuildPipeline.BuildAssetBundlesWithInfoInternal(outputPath, builds, assetBundleOptions, targetPlatform);
            }
            catch (Exception exception)
            {
                BuildPipeline.LogBuildExceptionAndExit("BuildPipeline.BuildAssetBundles", exception);
                result = null;
            }
            return(result);
        }
Beispiel #4
0
        private static BuildReport BuildPlayer(string[] scenes, string locationPathName, string assetBundleManifestPath, BuildTargetGroup buildTargetGroup, BuildTarget target, BuildOptions options)
        {
            if (BuildPipeline.isBuildingPlayer)
            {
                throw new InvalidOperationException("Cannot start a new build because there is already a build in progress.");
            }
            if (buildTargetGroup == BuildTargetGroup.Unknown)
            {
                buildTargetGroup = BuildPipeline.GetBuildTargetGroup(target);
            }
            string message;

            if (!BuildPipeline.ValidateLocationPathNameForBuildTargetGroup(locationPathName, buildTargetGroup, target, options, out message))
            {
                throw new ArgumentException(message);
            }
            BuildReport result;

            try
            {
                result = BuildPipeline.BuildPlayerInternal(scenes, locationPathName, assetBundleManifestPath, buildTargetGroup, target, options);
            }
            catch (Exception exception)
            {
                BuildPipeline.LogBuildExceptionAndExit("BuildPipeline.BuildPlayer", exception);
                result = null;
            }
            return(result);
        }
Beispiel #5
0
 /// <summary>
 ///   <para>Builds a player.</para>
 /// </summary>
 /// <param name="levels">The scenes to be included in the build. If empty, the currently open scene will be built. Paths are relative to the project folder (AssetsMyLevelsMyScene.unity).</param>
 /// <param name="locationPathName">The path where the application will be built.</param>
 /// <param name="target">The BuildTarget to build.</param>
 /// <param name="options">Additional BuildOptions, like whether to run the built player.</param>
 /// <returns>
 ///   <para>An error message if an error occurred.</para>
 /// </returns>
 public static string BuildPlayer(string[] levels, string locationPathName, BuildTarget target, BuildOptions options)
 {
     try
     {
         uint crc;
         return(BuildPipeline.BuildPlayerInternal(levels, locationPathName, target, options, out crc));
     }
     catch (Exception ex)
     {
         BuildPipeline.LogBuildExceptionAndExit("BuildPipeline.BuildPlayer", ex);
         return(string.Empty);
     }
 }
Beispiel #6
0
 public static bool BuildAssetBundleExplicitAssetNames(UnityEngine.Object[] assets, string[] assetNames, string pathName, out uint crc, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform)
 {
     crc = 0U;
     try
     {
         return(BuildPipeline.BuildAssetBundleInternal((UnityEngine.Object)null, assets, assetNames, pathName, assetBundleOptions, targetPlatform, out crc));
     }
     catch (Exception ex)
     {
         BuildPipeline.LogBuildExceptionAndExit("BuildPipeline.BuildAssetBundleExplicitAssetNames", ex);
         return(false);
     }
 }
Beispiel #7
0
 public static string BuildStreamedSceneAssetBundle(string[] levels, string locationPath, BuildTarget target, out uint crc, BuildOptions options)
 {
     crc = 0U;
     try
     {
         return(BuildPipeline.BuildPlayerInternal(levels, locationPath, target, options | BuildOptions.BuildAdditionalStreamedScenes, out crc));
     }
     catch (Exception ex)
     {
         BuildPipeline.LogBuildExceptionAndExit("BuildPipeline.BuildStreamedSceneAssetBundle", ex);
         return(string.Empty);
     }
 }
Beispiel #8
0
        internal static bool BuildAssetBundleExplicitAssetNames(UnityEngine.Object[] assets, string[] assetNames, string pathName, out uint crc, BuildAssetBundleOptions assetBundleOptions, BuildTargetGroup targetPlatformGroup, BuildTarget targetPlatform)
        {
            crc = 0u;
            bool result;

            try
            {
                result = BuildPipeline.BuildAssetBundleInternal(null, assets, assetNames, pathName, assetBundleOptions, targetPlatformGroup, targetPlatform, out crc);
            }
            catch (Exception exception)
            {
                BuildPipeline.LogBuildExceptionAndExit("BuildPipeline.BuildAssetBundleExplicitAssetNames", exception);
                result = false;
            }
            return(result);
        }
        public static bool BuildAssetBundle(UnityEngine.Object mainAsset, UnityEngine.Object[] assets, string pathName, out uint crc, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform)
        {
            crc = 0u;
            bool result;

            try
            {
                result = BuildPipeline.BuildAssetBundleInternal(mainAsset, assets, null, pathName, assetBundleOptions, targetPlatform, out crc);
            }
            catch (Exception exception)
            {
                BuildPipeline.LogBuildExceptionAndExit("BuildPipeline.BuildAssetBundle", exception);
                result = false;
            }
            return(result);
        }
Beispiel #10
0
        public static string BuildPlayer(string[] levels, string locationPathName, BuildTarget target, BuildOptions options)
        {
            string result;

            try
            {
                uint num;
                result = BuildPipeline.BuildPlayerInternal(levels, locationPathName, target, options, out num);
            }
            catch (Exception exception)
            {
                BuildPipeline.LogBuildExceptionAndExit("BuildPipeline.BuildPlayer", exception);
                result = string.Empty;
            }
            return(result);
        }
Beispiel #11
0
 /// <summary>
 ///   <para>Build all AssetBundles specified in the editor.</para>
 /// </summary>
 /// <param name="outputPath">Output path for the AssetBundles.</param>
 /// <param name="assetBundleOptions">AssetBundle building options.</param>
 /// <param name="targetPlatform">Target build platform.</param>
 public static AssetBundleManifest BuildAssetBundles(string outputPath, [DefaultValue("BuildAssetBundleOptions.None")] BuildAssetBundleOptions assetBundleOptions, [DefaultValue("BuildTarget.WebPlayer")] BuildTarget targetPlatform)
 {
     if (!Directory.Exists(outputPath))
     {
         Debug.LogError((object)("The output path \"" + outputPath + "\" doesn't exist"));
         return((AssetBundleManifest)null);
     }
     try
     {
         return(BuildPipeline.BuildAssetBundlesInternal(outputPath, assetBundleOptions, targetPlatform));
     }
     catch (Exception ex)
     {
         BuildPipeline.LogBuildExceptionAndExit("BuildPipeline.BuildAssetBundles", ex);
         return((AssetBundleManifest)null);
     }
 }
Beispiel #12
0
        internal static string BuildStreamedSceneAssetBundle(string[] levels, string locationPath, BuildTargetGroup buildTargetGroup, BuildTarget target, out uint crc, BuildOptions options)
        {
            crc = 0u;
            string result;

            try
            {
                BuildReport buildReport = BuildPipeline.BuildPlayerInternal(levels, locationPath, null, buildTargetGroup, target, options | BuildOptions.BuildAdditionalStreamedScenes | BuildOptions.ComputeCRC);
                crc = buildReport.crc;
                string text = buildReport.SummarizeErrors();
                UnityEngine.Object.DestroyImmediate(buildReport, true);
                result = text;
            }
            catch (Exception exception)
            {
                BuildPipeline.LogBuildExceptionAndExit("BuildPipeline.BuildStreamedSceneAssetBundle", exception);
                result = "";
            }
            return(result);
        }
Beispiel #13
0
        public static AssetBundleManifest BuildAssetBundles(string outputPath, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform)
        {
            if (!Directory.Exists(outputPath))
            {
                Debug.LogError("The output path \"" + outputPath + "\" doesn't exist");
                return(null);
            }
            AssetBundleManifest result;

            try
            {
                result = BuildPipeline.BuildAssetBundlesInternal(outputPath, assetBundleOptions, targetPlatform);
            }
            catch (Exception exception)
            {
                BuildPipeline.LogBuildExceptionAndExit("BuildPipeline.BuildAssetBundles", exception);
                result = null;
            }
            return(result);
        }