private static BuildPlayerInternal ( string levels, string locationPathName, string assetBundleManifestPath, BuildTarget target, BuildOptions options ) : BuildReport | ||
levels | string | |
locationPathName | string | |
assetBundleManifestPath | string | |
target | BuildTarget | |
options | BuildOptions | |
return | BuildReport |
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); }
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); }
/// <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); } }
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); } }
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); }
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); }