Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


CreateBuildProfile(GUID, string, UnityAction<BuildProfile>)

Creates a new build profile asset for the specified platform with the provided name and places it under Assets/Settings/Build Profiles.
Read time 1 minuteLast updated 12 days ago

Definition

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

Parameters

platformId

GUID
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.

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

Type

Description

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

Remarks

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 reloadBuildProfile 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.