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
- Type: Method
- Namespace: UnityEditor.Build.Profile
- Assembly: UnityEditor.CoreModule
public static BuildProfile CreateBuildProfile(GUID platformId, string profileName, UnityAction<BuildProfile> onProfileReady = null)
Parameters
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 |
|---|---|
| BuildProfile | The 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: . If a profile with the same name exists, a unique name is generated.
Assets/Settings/Build Profiles/{profileName}.asset//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.