Version: Unity 6.5 Alpha (6000.5)
LanguageEnglish
  • C#

BuildProfile.CreateBuildProfile

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

Declaration

public static BuildProfile CreateBuildProfile(GUID platformId, string profileName, UnityAction<BuildProfile> onProfileReady);

Parameters

Parameter Description
platformId The GUID of the target platform. Must be a valid platform installed in the Unity Editor.
profileName The name for the build profile. Used as the asset filename.
onProfileReady Optional callback invoked when the profile completes initialization and is ready to use. The callback must be static or on a serialized UnityEngine.Object to survive domain reloads. Non-persistent callbacks fail to invoke if a domain reload occurs during initialization.

Returns

BuildProfile The newly created BuildProfile instance. The profile may require initialization if platform packages need to be installed.

Description

Creates a new build profile asset for the specified platform with the provided name and places it under Assets/Settings/BuildProfiles.

This method automatically installs required platform packages if they are not already installed. Package installation happens asynchronously and begins immediately.

Unity creates the profile at: Assets/Settings/Build Profiles/{profileName}.asset. If a profile with the same name exists, a unique name is generated.

//Static method example - will continue after a domain reload
BuildProfile profile = BuildProfile.CreateBuildProfile(
    androidGuid,
    "My Profile",
    OnProfileReadyStatic);

static void OnProfileReadyStatic(BuildProfile profile) { Debug.Log($"Profile {profile.name} ready!"); }

Use BuildProfile.GetInstalledPlatformModules to fetch installed platform identifiers.