BuildDestinationSettings
A build profile component that specifies the destination path Unity uses when it builds the profile.
Read time 4 minutesLast updated 11 days ago
Definition
- Type: Class
- Namespace: UnityEditor.Build.Profile
- Assembly: UnityEditor.CoreModule
- Inherits from: ScriptableObject
public class BuildDestinationSettings : ScriptableObject
Remarks
Add this component to a build profile to set a build location for the profile. When the profile is active, Unity uses the resolved value of BuildDestinationSettings.buildPath as the output path for the build. If you start a build with BuildPipeline.BuildPlayer(BuildPlayerWithProfileOptions) or from the command line and provide a build path, Unity uses that path instead of the value in this component.
buildPathExamples
using UnityEditor;using UnityEditor.Build.Profile;using UnityEngine;public static class BuildDestinationExample{ [MenuItem("Build/Build iOS Demo")] public static void MyBuild() { BuildProfile profile = AssetDatabase.LoadAssetAtPath<BuildProfile>( "Assets/Settings/Build Profiles/iOSDemo.asset"); if (profile == null) return; // Get or create the BuildDestinationSettings component on the profile. var destination = profile.GetComponent<BuildDestinationSettings>(); if (destination == null) destination = profile.CreateComponent<BuildDestinationSettings>(); // Set a build path with a variable that resolves to the product name. destination.buildPath = "Builds/[UnityEditor.PlayerSettings.productName]"; // Reading buildPath returns the resolved path. // For example, "Builds/MyGame" when productName is "MyGame". Debug.Log($"Build destination: {destination.buildPath}"); // Unity automatically uses the resolved buildPath from // the BuildDestinationSettings component when building. BuildPipeline.BuildPlayer(new BuildPlayerWithProfileOptions { buildProfile = profile }); }}
Properties
Property | Description |
|---|---|
| buildPath | The destination path that Unity uses for the build. |
Inheritance
Operators
Operator | Description |
|---|---|
| operator == | Compares two object references to see if they refer to the same object. |
| bool | Determines whether the object exists. |
| operator != | Compares if two objects refer to a different object. |