Version: 5.6
public static string BuildPlayer (BuildPlayerOptions buildPlayerOptions);

Parámetros

buildPlayerOptions Provide various options to control the behavior of BuildPipeline.BuildPlayer.

Valor de retorno

string Un mensaje de error si un error ocurrió.

Descripción

Construye un player.

Use this function to programatically create a build of your project. Note that any references to GameObjects acquired in the editor script before the BuildPlayer call will be invalid after it and will need to be reacquired.

using UnityEditor;

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; BuildPipeline.BuildPlayer(buildPlayerOptions); } }

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

Parámetros

levels Las escenas que se incluirán en la compilación. Si está vacía, se construirá la escena actualmente abierta. Las rutas son relativas a la carpeta del proyecto (Assets/MyLevels/MyScene.unity).
locationPathName La ruta donde la aplicación será construida.
target El BuildTarget en construirse.
options Unas BuildOptions adicionales, como si ejecutar el player construido.

Valor de retorno

string Un mensaje de error si un error ocurrió.

Descripción

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