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

BuildHistory.RegisterExternalBuild

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 string RegisterExternalBuild(ExternalBuildInfo buildInfo);

Parameters

Parameter Description
buildInfo The description of the external build.

Returns

string The path of the new build report directory.

Description

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}"); } }