Skip to content

Latest commit

 

History

History
177 lines (99 loc) · 10.1 KB

com.unity.build-report-inspector.md

File metadata and controls

177 lines (99 loc) · 10.1 KB

About Build Report Inspector

This package contains an Editor script which implements an inspector for BuildReport files.

The BuildReport file is generated for Player builds ( BuildPipeline.BuildPlayer), as well as BuildPipeline.BuildAssetBundles.

This file records information about your last build, and helps you profile the time spent building your project and to understand the disk size footprint of the build output.

This package adds UI support for inspecting this information graphically in the Unity Editor Inspector view.

Note: The Addressables and Scriptable Build Pipeline packages do not generate a BuildReport file, but Addressables has its own UI for showing build results.

Alternatives to using this package

Another way to view the build report is using the Project Auditor package.

And you can also write your own custom script to access data about your builds, using the BuildReport scripting API

Preview package

This package is available as a preview.

This package is provided as-is, with no support from Unity Technologies.

It serves as a demonstration of the information available in the BuildReport file. It can be a useful tool "as-is" and continues to be functional in recent versions of Unity, for example Unity 6.

Package contents

The following table describes the package folder structure:

Location Description
Editor Contains the package scripts.

Installation

To install this package, follow the instructions in the Package Manager documentation.

A recommended way is to install the package from github:

Clone this repository. Alternatively download it as a zip file and expand it to a location on your local hard drive. Typically it is best to use the "main" branch which has the latest recommended version.

In the Unity Package Manager Window select "Add package from disk" and select the package.json file inside the com.unity.build-report-inspector folder in your copy of this project.

Once the package is added the custom view will appear any time you use the Inspector to view a BuildReport file.

This script adds a convenient menu shortcut (Window/Open Last Build Report), to copy that file to the Assets folder and select it, so you can inspect it using the Build Report Inspector.

Requirements

This version of Build Report Inspector is compatible with the following versions of the Unity Editor:

  • 2021.3 and later. It may also be functional in 2019 and 2020 versions.

Using Build Report Inspector

Unity will write the BuildReport to Library/LastBuild.buildreport when making a build. This location is cannot be reached from the Project view, but the file can manually be copied somewhere inside the Assets folder to view it.

This package adds a menu item Window/Open Last Build Report which will take care of copying the last build report file to the Assets/BuildReports folder and select it so that it can be viewed in the Inspector. The file will be renamed to include a time stamp so that you can have multiple build reports in the same folder.

Note: By default the Library/LastBuild.buildreport file is in binary serialization format. But when copied into the Assets folder it will be converted to yaml text format (provided the Asset Serialization project setting is set to "Text").

The Inspector Window includes have several tabs, which are described in the following sections:

Build steps

The different steps involved in making you build, how long they took, and what messages were printed during those steps (if any).

The equivalent information is exposed through the API by BuildReport.steps.

Note: when BuildOptions.DetailedBuildReport is used then the build steps will include much more information. The amount of build step data generated by this flag is not appropriate for large builds, but can be useful when diagnosing issues with smaller player builds.

Content Summary

A summary of the content of the build, including some overall statistics and then sizes and object counts aggregated by Type and Source Asset.

Note: because of compression and padding the actual size on disk can be different from the sizes reported here.

This is based on the same PackedAsset information from the BuildReport that is used to populate the SourceAssets tab. But this page focuses on showing key information.

The data shown in this view is only calculated on-demand, because the PackedAsset information can grow very large for large builds.

ContentSummary

Source assets

This page displays information about the objects and resources (audio clips, meshes and textures) and how they contribute to the build size. It shows details than the Content Summary tab.

Note: objects inside Scene files are not shown.

SourceAssets

There are three available views:

Size shows the objects grouped by their source asset and Type. If you hover over the entry the number of objects of the type inside the Asset is shown. Note: The same Asset can show up multiple times, because may contain multiple types of objects. And in the case of a Texture there will be an entry for the Texture object and another for the texture data (from the .resS file).

Output Data Files This show information about the content of the output files, based on the source asset and type. Hover over the entry to see the number of objects (or resources).

Importer Type This shows information about grouped by object type. This is useful to see the size of all objects and resources of a particular type, and which Assets contributed them.

For the API equivalent see PackedAssets.

Warning: This view aggregates information about every single object in the build. Currently this view is so slow that it is unusable for large builds (e.g. large numbers of Assets or prefabs with large GameObject hierarchies).

Output files

A list of all files written by the build

OutputFiles

An example for an AssetBundle build: OutputFiles

For the API equivalent see BuildReport.GetFiles.

Stripping

For platforms which support engine code stripping, a list of all engine modules added to the build, and what caused them to be included in the build.

Stripping

For the API equivalent see StrippingInfo.

This tab is only shown for Player builds because it is not relevant for AssetBundle builds.

Scenes using Assets

[Available from Unity 2020.1.0a6]

This tab is only populated when you use the BuildOptions.DetailedBuildReport build option when calling BuildPipeline.BuildPlayer in a custom build script. It is not available for AssetBundle builds.

This shows a list describing which scenes are using each asset of the build.

For the API equivalent see ScenesUsingAssets.

Mobile

The mobile appendix was introduced, starting with Unity 2019.3, to report additional data for mobile builds.

When present, the BuildReportInspector UI includes additional mobile-specific entries, such as architectures inside the build, App Store download sizes and the list of files inside the application bundle (.apk, .obb, .aab for Android and .ipa for iOS/tvOS).

Android

The mobile appendix is generated automatically for Android builds using build callbacks, immediately after Unity exports the application bundle.

This appendix information is saved in a file in the "Assets/BuildReports/Mobile" directory named after the build's unique GUID.

iOS

Because Unity does not export .ipa bundles directly, they need to be generated manually by the user. When an iOS build report is opened in Unity, the BuildReportInspector UI will display a prompt to open an .ipa bundle for more detailed information about the build, as shown in the image below.

To generate a development .ipa bundle:

  1. Open the Xcode project exported by Unity.
  2. In the menu bar, go to Product > Archive.
  3. Once Xcode finishes archiving, click Distribute App.
  4. Select Development distribution method, go to next step.
  5. Select desired App Thinning and Bitcode options, go to next step.
  6. Set valid signing credentials and click Next.
  7. Once Xcode finishes distributing, click Export and select where to save the distributed files.

Once these steps are complete, an .ipa bundle will be inside the directory, saved in step 7.
This process can also be automated using the xcodebuild command line tool.
After the .ipa bundle is provided, the iOS-specific information is added to the BuildReportInspector UI automatically.


Contributing

The source for Build Report Inspector package is available at https://github.com/Unity-Technologies/BuildReportInspector
For contributions, please refer to the repository's CONTRIBUTING.md file.