| Parameter | Description |
|---|---|
| buildSessionGuid | The build session GUID of the build to select, for example BuildSummary.buildSessionGuid or a GUID returned by BuildHistory.GetAllBuilds. Passing an empty GUID throws an ArgumentException. |
Opens the Build Analysis window and selects a build from the build history.
Use this method to show a build right after it completes, or after you add a build to the build
history with Build.BuildHistory.RegisterExternalBuild.
If the build history contains no build with this GUID, the window still opens, keeps its current
selection, and logs a warning to the Console.
using UnityEditor; using UnityEditor.Build.Analysis; using UnityEditor.Build.Reporting; using UnityEngine;
public class OpenBuildAnalysisWindowExample { [MenuItem("Example/Build Analysis/Build Player and Analyze")] static void BuildPlayerAndAnalyze() { var options = new BuildPlayerOptions { scenes = new[] { "Assets/Scenes/SampleScene.unity" }, locationPathName = "Builds/MyGame", target = EditorUserBuildSettings.activeBuildTarget, };
BuildReport report = BuildPipeline.BuildPlayer(options); Debug.Log($"Build finished with result: {report.summary.result}");
// Open the Build Analysis window with the new build selected. BuildAnalysisUtility.OpenWindow(report.summary.buildSessionGuid); } }