| Parameter | Description |
|---|---|
| buildInfo | The description of the external build. |
string The path of the new build report directory.
Registers a build performed by an external build pipeline in the build history.
Call this method from the main thread when a build performed outside the Unity build pipeline has finished, to make it appear in the build history and the Build Analysis window alongside Player and Content Directory builds.
using System; using System.IO; using UnityEditor; using UnityEditor.Build; using UnityEditor.Build.Reporting; using UnityEngine;
public class RegisterExternalBuildExample { [MenuItem("Example/BuildHistory/Register External Build")] static public void RegisterExternalBuild() { // Record a build performed by an external build pipeline in the build history, // so it appears in the Build Analysis window alongside other builds. var buildInfo = new ExternalBuildInfo { BuildSessionGUID = GUID.Generate(), BuildName = "MyExternalBuild", BuildType = BuildType.AssetBundle, BuildResult = BuildResult.Succeeded, BuildStartedAt = DateTimeOffset.UtcNow, Platform = EditorUserBuildSettings.activeBuildTarget, TotalTime = TimeSpan.FromSeconds(1.5), TotalSizeBytes = 1024 * 1024, OutputPath = "Builds/MyExternalBuild", };
string buildReportDirectory = BuildHistory.RegisterExternalBuild(buildInfo);
// Add extra files describing the build to the returned directory; // retrieve them later with BuildHistory.TryGetFilePath(). File.WriteAllText(Path.Combine(buildReportDirectory, "MyExternalPipelineData.json"), "{}");
Debug.Log($"Registered external build in the build history at: {buildReportDirectory}"); } }