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);
}