public static Build.Reporting.BuildReport BuildPlayer (BuildPlayerOptions buildPlayerOptions);

パラメーター

buildPlayerOptionsProvide various options to control the behavior of BuildPipeline.BuildPlayer.

戻り値

BuildReport A BuildReport giving build process information.

説明

プレイヤーをビルドします。

プログラムから Unity プロジェクトをビルドするにはこの関数を使用します。 この関数を呼び出す直前にエディタースクリプトで取得したゲームオブジェクトへの参照は、すべて取り消されるので再取得しなければいけないことに注意してください。

using UnityEditor;
using UnityEngine;
using UnityEditor.Build.Reporting;

// Output the build size or a failure depending on BuildPlayer.

public class BuildPlayerExample : MonoBehaviour { [MenuItem("Build/Build iOS")] public static void MyBuild() { BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions(); buildPlayerOptions.scenes = new[] { "Assets/Scene1.unity", "Assets/Scene2.unity" }; buildPlayerOptions.locationPathName = "iOSBuild"; buildPlayerOptions.target = BuildTarget.iOS; buildPlayerOptions.options = BuildOptions.None;

BuildReport report = BuildPipeline.BuildPlayer(buildPlayerOptions); BuildSummary summary = report.summary;

if (summary.result == BuildResult.Succeeded) { Debug.Log("Build succeeded: " + summary.totalSize + " bytes"); }

if (summary.result == BuildResult.Failed) { Debug.Log("Build failed"); } } }

public static Build.Reporting.BuildReport BuildPlayer (string[] levels, string locationPathName, BuildTarget target, BuildOptions options);
public static Build.Reporting.BuildReport BuildPlayer (EditorBuildSettingsScene[] levels, string locationPathName, BuildTarget target, BuildOptions options);

パラメーター

levelsThe Scenes to be included in the build. If empty, the currently open Scene will be built. Paths are relative to the project folder (Assets/MyLevels/MyScene.unity).
locationPathName成果物の保存先のパス
targetビルドする BuildTarget
optionsビルドしたプレイヤーを実行するか、などの追加の BuildOptions

戻り値

BuildReport エラーが発生した場合、エラーメッセージを返します。

説明

Builds a player. These overloads are still supported, but will be replaced. Please use BuildPlayer (BuildPlayerOptions buildPlayerOptions) instead.