Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

BuildDestinationSettings

class in UnityEditor.Build.Profile

/

Inherits from:ScriptableObject

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

A build profile component that specifies the destination path Unity uses when it builds the profile.

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 buildPath value in this component.

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
buildPathThe destination path that Unity uses for the build.

Inherited Members

Properties

PropertyDescription
hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameThe name of the object.

Public Methods

MethodDescription
GetEntityIdGets the EntityId of the object.
ToStringReturns the name of the object.

Static Methods

MethodDescription
DestroyRemoves a GameObject, component, or asset.
DestroyImmediateDestroys the specified object immediately. Use with caution and in Edit mode only.
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindAnyObjectByTypeRetrieves any active loaded object of Type type.
FindObjectsByTypeRetrieves a list of all loaded objects of Type type.
InstantiateClones the object original and returns the clone.
InstantiateAsyncCaptures a snapshot of the original object (that must be related to some GameObject) and returns the AsyncInstantiateOperation.
CreateInstanceCreates an instance of a scriptable object.

Operators

OperatorDescription
boolDoes the object exist?
operator !=Compares if two objects refer to a different object.
operator ==Compares two object references to see if they refer to the same object.

Messages

MessageDescription
AwakeCalled when an instance of ScriptableObject is created.
OnDestroyThis function is called when the scriptable object will be destroyed.
OnDisableThis function is called when the scriptable object goes out of scope.
OnEnableThis function is called when the object is loaded.
OnValidateEditor-only function that Unity calls when the script is loaded or a value changes in the Inspector.
ResetReset to default values.