Exemple #1
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);
        }
        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);
        }