Build Report Tool - Track files in your project that need slimming down!

A new version is coming up soon!

Added a new column on the Used Assets List: Size Before Build. This is to help clarify how the size of your asset has changed upon being included in the build.

I’ve included a few bug fixes as well.

@littlewormcug : I’ve made some updates to Build Report Tool that may help. I found out PostProcessBuildAttribute gets called right before any build data is output on the editor log, so it was actually not working.

In the upcoming new version, I’ve made a method that you can call to manually generate a report: BuildReportTool.ReportGenerator.CreateReport(). It should be called after BuildPipeline.BuildPlayer()

A sample build script would look like this:

using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

public class SimpleBuilder
{
    static void Build()
    {
        BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();

        if (EditorBuildSettings.scenes.Length == 0)
        {
            // no scenes to build!

            EditorApplication.Exit(1);
            return;
        }

        // just include the first scene
        buildPlayerOptions.scenes = new[] {EditorBuildSettings.scenes[0].path};
     
        buildPlayerOptions.locationPathName = "C:\\Files\\Projects\\Self\\BRT\\Builds\\U2017_2_Win64\\test.exe";
        buildPlayerOptions.target = BuildTarget.StandaloneWindows64;
        buildPlayerOptions.options = BuildOptions.None;
        BuildPipeline.BuildPlayer(buildPlayerOptions);

        BuildReportTool.ReportGenerator.CreateReport();

        EditorApplication.Exit(0);
    }
}

I’ve submittted this to the Asset Store, and it should take about 1 to 2 weeks to go live.

EDIT: Version 3.4 is out!

I must own about 250 unity store assets, and only two times prior to this have I seen a requirement to agree to an additional license. In those two cases the developers had the requirement removed, because it was unnecessary.

The Eclipse License does not mandate that you or the Unity asset store require me to accept and agree to the license. The license applies to you, the contributor/distributor, not me. It requires you to supply a copy of the license to me (if you provide source code) along with Build Report Tool, not force me to acknowledge/accept the license. You should take the license to your attorney, get advised, and arrange with Unity to have the purchaser acceptance removed.

The license notice was required by Unity. It’s not my decision to put it there. When I submitted Build Report Tool to the Asset Store, I have to indicate the licenses of any 3rd party libraries I use.

This is from the https://unity3d.com/asset-store/sell-assets/submission-guidelines:


The fact that the Asset Store is making it sound like you have to be the one to agree to the license is wrong. I’ll try to clarify that the license notice pertains only to FuzzyString so there’s no misunderstanding.

EDIT: I’ve resubmitted my update with the modified license.txt. It just states:

1 Like

Thanks for the clarification, and that is certainly a far friendlier notice. Well done!

I can see that Unity is simply trying to avoid any possible liability without actually considering the language and facts surrounding each license situation. It’s the corporate way.

Build Report Tool has been on my Wish List for a while. We have been working on other aspects of our project, but we will be getting back to making builds, and I expect there will be some surprises. I look for ward to using Build Report Tool to help improve our game build.

Thanks,it will help a lot.
About the Editor.log,I have some doubts.I have found that the size log in the Editor.log is not always exact.In Unity5.6.0,I build some IOS package,but the file size in the Editor.log is unnormal. These file size can be recompute with the file size in Library/metacache .But some file ,for example in my project building Editor.log,I have a file “Built-in Texture2D: SpriteAtlasTexture-Effect (Group 0)-2048x2048-fmt33”,it is wrong size and it can not get a UDID,so it is no way recompute the size.It is may be the bug of unity5.6.0,because I build my project with Unity2017.2.0 and see the normal size of this file.
So,I think that if it is possible for BRT to resolve this problem?

(In IOS building,some Script DLLs have this problem too,in BRT their size is ?)

I’ll look into the problem with the SpriteAtlasTexture assets. Yeah it seems to be a bug in Unity 5.6. I’ll look into it when I get the time.

When the DLL size is “?” it means Build Report Tool can’t find the file so it can’t get its file size. I always try my best to look for the folder where the files are but the path may have changed in the latest versions of Unity. I’ll also try to look into that.

Hello, I have bought this awesome, very useful and great tool and works very well, BUT this was until today, I updated to the latest version 3.4.1 ( 5 December ) and now it does NOT build the report.
I am using Unity 5.5.2

STEPS THAT I DO

1 - Go to build setting and build the project with all the needed scenes
2 - Import the build report asset
3 - Click on the Get Log button
4 - It shows then the “Getting total build size” message and “List of used assets” and it seems to load many things
5 - When it finishes it shows again the “No Build Info” message
6 - If I click again the Get Log button, it happens the same as point 4 and 5
7 - If I build again the project to see if something may have wrong when building the first time
8 - I go to point 3 and happens exactly the same
9 - I have import report tool asset in a backup of the project and build the project and happens the same

Please, can you help to tell what may be happening?

Thanks very much

Alright thanks for the steps. I’ll try to look into that when I get the time.

In the meantime, if you don’t have a copy anymore of the older version that was working for you, I could give you that older version (if you’re aware of which old version you were using back then, tell me and I could give you a .unitypackage file of that). Just email or private message me your invoice number.

1 Like

Thanks very much for your answer, I have already sent you a PM with the invoice number

BUILD REPORT TOOL OF A SINGLE SCENE?

When you make the build report you get all the data that is given by the build settings scenes included in that build, so all the used assets data are only from those assets included in the scenes included in build settings

But, if I want to get what are all the used assets of just one single scene from my project, would then be needed that I make a build with just ONLY that single scene? so I think that then the Build report tool would only have the data from that single scene, or I am wrong?

Thanks

Hi, I have made some tests in Unity 5.5.2 with both versions, and it seems that the problem is with version 3.4, because when using 3.3 it works correctly.

I thought it was on 3.4.1 but it is really from 3.4 that has the errors

Hope it helps you

Is it possible / would it be possible to inspect builds done by Cloud Build with this? By analysing the output log of Cloud Build or something?

That’s partly right. The catch is that there are certain assets that always gets included, even if they’re not used in any scene:

  • Anything in a Resources folder
  • Anything in the StreamingAssets folder

The good thing is that at least Build Report Tool will know when an asset is in any of those folders since you can filter them by folder name (the Filter dropdown box in the Used Assets list).

Yes, but what you’ll have to do is download the full log from the project’s cloud build dashboard, save it as a txt file, then have Build Report Tool make use of that using the Options (use Set Override Log). Then click the Get Log button.

Right now, there’s no automatic way for Build Report Tool to download the log file itself.

But note that I still need to fix some things to make it work properly (some entries are showing up as ??? in the size stats when they shouldn’t).

Hi! I’m loving this asset! Thanks for making it!

Unfortunately, I’m unable to get logs from my iOS builds. I’ve tracked the issue down to the scriptdlls section, which doesn’t seem to be getting populated. This means it returns false for hasContents, so the log won’t open. I commented the scriptDLL stuff out & then it opens, but the calculations seem off. Any chance you can help?

here’s the relevant section:

Hi, yes, another user reported to me something similar regarding the hasContents. I have a fix coming soon, I will let you know once it’s out!

Can you explain more about calculations seeming off?

@AnomalusUndrdog

Here’s what I mean: In the GUI (which is only appearing bc I commented out those lines), the build size is much larger than in finder. See below. Note that I believe this behaved as expected in the builds I made before commenting out the hasContents check.

That’s certainly strange. I received a bug report from a similar having the same issue and he was also using a Mac.

I’m using System.IO.FileInfo.Length to calculate file size, and for a folder I simply total up the file sizes of the files in the folder (plus all its subfolders). So I don’t know what’s wrong here. I don’t have a Mac so I can’t easily recreate the problem.

Question though: does that folder have any symlink or hard links? It may be accidentally including those in the file size calculations.

The moment in the code where it gets the total build size for Mac standalone builds is line 1957 in BRT_ReportGenerator.cs (and for iOS builds it’s just 5 lines below that).

All they do is sum up the sizes of all files in the build folder. And the build folder path is obtained via UnityEditor.EditorUserBuildSettings.GetBuildLocation().

The code for actually calculating total size starts at BuildReportTool.Util.GetPathSizeReadable (at line 354 of BRT_Util.cs) if you’re feeling adventurous in looking into it.

The way it recursively finds all files in a given folder is using my utility class TraverseDirectory (in the file DldUtil_TraverseDirectory.cs). The .NET 2.0 that Unity has doesn’t have the API to do this, which is why I ended up having to make that in the first place. It loops through the files using a stack instead of recursive function calls, to prevent a stack overflow.

Note: Version 3.4.2 is out! I didn’t get a notification from Unity about it, but it seems the Asset Store page has been updated. But please note 3.4.2 still doesn’t fix this file size display problem.

@AnomalusUndrdog I bet this issue is caused by symlinking the unity libraries. I’ll stop doing that & confirm that it fixes the issue. Happy to test a fix on my Mac for you if you have thoughts on how to fix it.

Also: Your build size tool is far & away the best I’ve used (and I’ve used most of 'em by now). We would never have fit Getting Over It on iOS under 150mb without you, so thanks!

Hey! Maybe I can ask here when you made this I figured you know stuff… I have reach the 4gb textures limit in the resource size file…

And that sucks! I cant have all textures 4k wich would look amazing (crap engine)…
And this issue havent still been fixed…

My question is:

If I have 100 textures imported but only use 20 on a house in my scene… are those other 80 that is not in the scene still counted in the build?

My suggestion is to look into Asset Bundles. They are like the resources folder, but instead of being bundled into the Unity build, they are exported into a file. You can have many asset bundles that your program uses, so you could distribute your 4k textures into many asset bundles, which I think will help you with the 4 gb file size limit.

For your question: no, they won’t end up in the build. An asset will only be in a build if they are “used”. Used meaning:

  • They are in a scene, and that scene is included in the build
  • They are in a Resources folder
  • They are referenced by a prefab (or scriptable object) that is either used in a scene (that is included in the build), or is in a Resources folder.
  • They are in the StreamingAssets folder.