BuildTarget
Specifies the target platform for a Player or AssetBundle build.
Read time 1 minuteLast updated 5 days ago
Definition
- Type: Enum
- Namespace: UnityEditor
- Assembly: UnityEditor.CoreModule
public enum BuildTarget
Remarks
Pass a platform property to to specify the target platform to build a Player for. For example, use BuildTarget.Android to target the Android platform. At runtime, use to identify the currently selected build target. Only actively supported platforms are documented in this list.
BuildTargetBuildTargetImportant: When targeting Windows, it's recommended to use the target unless you specifically need to target devices that use a 32-bit CPU.
StandaloneWindow64Examples
using UnityEditor;namespace BuildDocExamples{ // Build your project on multiple platforms in a single action public static class BuildTarget_BuildAllExample { [MenuItem("BuildDocExamples/Build/Build All Platforms")] public static void BuildAllPlatforms() { string[] buildScenes = { "Assets/PathToYourScene.unity" }; string projectName = "MyGame"; // Build for Windows BuildPipeline.BuildPlayer(buildScenes, $"BuildsWindows{projectName}.exe", BuildTarget.StandaloneWindows64, BuildOptions.None); // Build for macOS BuildPipeline.BuildPlayer(buildScenes, $"BuildsmacOS{projectName}.app", BuildTarget.StandaloneOSX, BuildOptions.None); // Build for Android BuildPipeline.BuildPlayer(buildScenes, $"BuildsAndroid{projectName}.apk", BuildTarget.Android, BuildOptions.None); } }}
Fields
Value | Description |
|---|---|
| Android | Build an Android .apk standalone app. |
| GameCoreXboxOne | Build an Xbox one player. |
| GameCoreXboxSeries | Build an Xbox Series player. |
| LinuxHeadlessSimulation | Build a LinuxHeadlessSimulation standalone. |
| PS4 | Build a PS4 Standalone. |
| PS5 | Build to PlayStation 5 platform. |
| StandaloneLinux64 | Build a Linux 64-bit standalone. |
| StandaloneOSX | Build a macOS standalone. |
| StandaloneWindows | Build a Windows 32-bit standalone. |
| StandaloneWindows64 | Build a Windows 64-bit standalone. |
| Switch | Build a Nintendo Switch™ player. |
| Switch2 | Build a Nintendo Switch™ 2 player. |
| VisionOS | Build a visionOS player. |
| WebGL | Build to WebGL platform. |
| WSAPlayer | Build an Windows Store Apps player. |
| XboxOne | Build an Xbox One Standalone. |