Search Unity

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

Discussion in 'Assets and Asset Store' started by AnomalusUndrdog, Apr 14, 2013.

?

How much would you be willing to pay for this?

Poll closed Oct 26, 2015.
  1. $2

    23.5%
  2. $5

    50.0%
  3. $10

    26.5%
  1. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    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:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEditor;
    4. using UnityEngine;
    5.  
    6. public class SimpleBuilder
    7. {
    8.     static void Build()
    9.     {
    10.         BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();
    11.  
    12.         if (EditorBuildSettings.scenes.Length == 0)
    13.         {
    14.             // no scenes to build!
    15.  
    16.             EditorApplication.Exit(1);
    17.             return;
    18.         }
    19.  
    20.         // just include the first scene
    21.         buildPlayerOptions.scenes = new[] {EditorBuildSettings.scenes[0].path};
    22.      
    23.         buildPlayerOptions.locationPathName = "C:\\Files\\Projects\\Self\\BRT\\Builds\\U2017_2_Win64\\test.exe";
    24.         buildPlayerOptions.target = BuildTarget.StandaloneWindows64;
    25.         buildPlayerOptions.options = BuildOptions.None;
    26.         BuildPipeline.BuildPlayer(buildPlayerOptions);
    27.  
    28.         BuildReportTool.ReportGenerator.CreateReport();
    29.  
    30.         EditorApplication.Exit(0);
    31.     }
    32. }
    33.  


    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!
     
    Last edited: Dec 1, 2017
  2. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    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.
     
  3. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    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:
     
    Last edited: Nov 30, 2017
    wood333 likes this.
  4. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    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.
     
  5. littlewormcug

    littlewormcug

    Joined:
    Oct 11, 2017
    Posts:
    8
    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 ?)
     
  6. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    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.
     
  7. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    455
    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
     
    Last edited: Dec 5, 2017
  8. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    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.
     
    SpaceRay likes this.
  9. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    455
    Thanks very much for your answer, I have already sent you a PM with the invoice number
     
  10. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    455
    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
     
  11. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    455
    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
     
  12. mihakinova

    mihakinova

    Joined:
    Jan 6, 2015
    Posts:
    85
    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?
     
  13. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    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:
    1. Anything in a Resources folder
    2. 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).
     
  14. maxiboch

    maxiboch

    Joined:
    Jan 13, 2015
    Posts:
    7
    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:

    <WebFileBuildSize />

    <AndroidApkFileBuildSize />

    <AndroidObbFileBuildSize />

    <MonoDLLs />

    <ScriptDLLs />

    <UnityEngineDLLs />

    <FileFilters>

    <FileFilters>
     
  15. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    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?
     
  16. maxiboch

    maxiboch

    Joined:
    Jan 13, 2015
    Posts:
    7
    @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.



     
  17. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    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.
     
  18. maxiboch

    maxiboch

    Joined:
    Jan 13, 2015
    Posts:
    7
    @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!
     
  19. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    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?
     
  20. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    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:
    1. They are in a scene, and that scene is included in the build
    2. They are in a Resources folder
    3. 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.
    4. They are in the StreamingAssets folder.
     
  21. Manlok

    Manlok

    Joined:
    Nov 17, 2012
    Posts:
    10
    Which Unity platform prefers support to for this tools?
     
  22. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    Hi, I'm not sure what you mean. Regardless of what platform you build your game on, Build Report Tool will provide a build report.
     
  23. jamesk5

    jamesk5

    Joined:
    Nov 26, 2012
    Posts:
    16
    Hi, I'm using cloud build for android and iOS platforms. Will this tool work, or does it require the project to be built locally in the editor? Sometimes I have problems building locally due to SDK wankiness.
     
  24. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    It's not specifically designed to work with cloud build, meaning it can't recognize the moment after a cloud build has been made to make a report for it.

    But what you can do is download the build log from your cloud build dashboard from the web browser, and feed that into the Build Report Tool to generate a report:

    From the Build Report Window's Options, you can set the override log, so using that, you choose the build log you downloaded.



    Then from the Build Report Window's toolbar, click the "Get Log" button.

    It should work for the most part, 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).
     
  25. jamesk5

    jamesk5

    Joined:
    Nov 26, 2012
    Posts:
    16
    Great, thanks for the info! Is there an ETA for extended cloud build support? And when cloud build is supported, will there be features that are still only available to local builds?
     
  26. Mynglam_13

    Mynglam_13

    Joined:
    Apr 11, 2014
    Posts:
    4
    Very useful tool, but seems I find bug, with Scripting Runtime Version .NET 4.6 in player settings, don't working. Stopped on "Getting build sizes...".
    Unity 2017.3.1p3
     
  27. AdamKane

    AdamKane

    Joined:
    Dec 3, 2012
    Posts:
    134
    In Unity 2017.3.1f1 I'm seeing the compiler errors in the attached screenshot.
     

    Attached Files:

  28. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    I'm afraid I can't guarantee anything yet, I'm really swamped with work right now. The way I see it, generating build reports from cloud builds should just work more or less the same way as local builds. I don't see a reason to restrict some features to local build. As long as you have the same project open, it should be able to access the same data that the cloud build's build log is referring to.

    Thanks for notifying me about this. I'll look into it.

    Hi, have you updated to the latest version of Build Report Tool? It should be 3.4.3
     
  29. WelchCompositions

    WelchCompositions

    Joined:
    Sep 30, 2013
    Posts:
    29
    Just picked up this tool, excited to use it! I hit "Get Log" and the button has stayed in a pressed state and Unity is unresponsive for the last ooooo maybe 5 minutes. I'm not seeng Unity as unresponsive in task manager but I imagine something went wrong. Any insight?
     
  30. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    Any error in the console log window? Also, what version of Unity are you using? Like Mynglam_13 mentioned above, it won't work properly with Scripting Runtime Version .NET 4.6 yet. I'll be working on that.
     
  31. WelchCompositions

    WelchCompositions

    Joined:
    Sep 30, 2013
    Posts:
    29
    oh weird it seems even having the tool inside my project completly broke my ability to build. Im using Unity 2017.3.1f1 Any idea why this would happen? I get to my third scene in my build process and then it just freezes and I have to restart Unity.
     
  32. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    Do a process of elimination to root out the cause. If you completely delete the BuildReport folder, does the build process work again (provided you didn't remove anything else or change any project setting)?

    To what platform are you building to anyway? I'll try to recreate the situation you have.

    I just did a test build in Unity 2017.3.1f1, building to Windows standalone, and Build Report Tool is working fine on my test project.
     
  33. WelchCompositions

    WelchCompositions

    Joined:
    Sep 30, 2013
    Posts:
    29
    How strange. Yeah once I removed it my builds were fine. Maybe Ill try adding it fresh again and building once more.
     
  34. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    301
    I have a great suggesion for this tool.

    - Showing mesh vertices / triangle sizes ( for each mesh ) after build. So developer can identify meshes with under 300 vertices and mark them "unstatic", so they can use dynamic batching instead of static batching. As you know static batching increases build size dramatically.

    Regards.
     
  35. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    Alright, let me know what happens.

    Good idea, I'll add it to my todo list.
     
    reggie_sgs likes this.
  36. p87

    p87

    Joined:
    Jun 6, 2013
    Posts:
    318
    interested in purchasing - need to verify, is this working in the latest version of unity 2018.1 ?
     
  37. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    I have tested it in 2018.1.0f2, and I built to Windows standalone and Android, and it works. Let me know what platform you're building on so I can try testing on it as well.

    Side note: I do plan on rewriting this to take advantage of 2018.1's new Build Report API, but I have no schedule for that yet.
     
  38. jamesk5

    jamesk5

    Joined:
    Nov 26, 2012
    Posts:
    16
    Hi Phil, I purchased for use with Cloud Build (Android, and soon iOS). You mentioned I could load the log from Cloud Build into Built Report Tool and it would mostly work, however your asset seems to want an XML file. I don't see how to generate an XML file from Cloud Build. Please advise.

    EDIT: just realized it could be important to build again after importing the asset. Thought I could open older logs. I am now building for the first time after importing, but I expect that only an APK file will be generated as usual. Please provide insight. :)
     
    Last edited: Jun 1, 2018
  39. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    I'm not sure who Phil is, but to load from a Cloud Build log file, you use the "Set Override Log" button in the Options menu:



    After that, click on the "Get Log" button, which will cause Build Report Tool to read from the log file you specified.


    I am not sure what your question is on this one, could you clarify please?
     
  40. jamesk5

    jamesk5

    Joined:
    Nov 26, 2012
    Posts:
    16
    Thanks Phil! Just kidding, sorry, but thank you! I was able to load the build report. :) Never mind the second question.

    FYI, I have 400+ textures that are included in my build via references on scriptable objects. The scriptable objects are referenced directly in a scene via an array on a component. But Build Report Tool lists these textures as unused. Maybe something to fix?

    As a side note, I thought I would help your asset recognize the textures were in use, so I created a new blank scene and referenced them all in an array of textures in a component. Haven't checked the log yet, but this actually increased by APK build size by 10MB. I submitted a bug report to Unity, as it seems the dependency checks at build time need to be improved. All I did was add more references to textures that were already being included in the build, so build size should not have increased.


     
  41. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    Hi @AnomalusUndrdog

    Are you planning a 2018.1 version which gets rid of the fullscreen depreciated warnings? upload_2018-7-3_21-42-51.png

    Many thanks,

    Justin
     
  42. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    Hi, yeah sorry about that. I'll be working on quick-fixes for those. In the future, I'm looking into taking advantage of the Build Report API now present in Unity 2018.

    UPDATE: Version 3.4.6 has been submitted to the Asset Store. It fixes compatibility with Unity 2018 plus some minor bug fixes.
     
    Last edited: Jul 9, 2018
  43. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
  44. matthewhxq

    matthewhxq

    Joined:
    Jul 6, 2015
    Posts:
    21
    Code (CSharp):
    1. inPart.Percentage = Double.Parse(gotPercent);
    This line in two places is generating exception so the build report is not loading. I replaced it with TryParse and it's working great. Just a little heads-up

    Unity 2018.2.1f1
    .Net 4
     
  45. MetaDOS

    MetaDOS

    Joined:
    Nov 10, 2013
    Posts:
    157
    Hi,
    Is there any way to let the plugin read Unity Cloud log?
     
  46. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    Hi, yes. To load from a Cloud Build log file, you use the "Set Override Log" button in the Options menu:


    After that, click on the "Get Log" button, which will cause Build Report Tool to read from the log file you specified.


    @matthewhxq: Sorry about that, I'll see to including that in a bugfix update.
     
    MetaDOS likes this.
  47. MetaDOS

    MetaDOS

    Joined:
    Nov 10, 2013
    Posts:
    157
    It doesn't work. The tool still read my latest build
    2018-08-19_11-24-42.jpg

    Step:
    Copy the plain text log from Cloud Build (full log) to Notepad++ and save to mybuild.log
    Use the Override log as you guided.
     
  48. abhuva

    abhuva

    Joined:
    Dec 23, 2011
    Posts:
    76
    Getting the following error after installing (unity 2018.2)
    Assets/BuildReport/Scripts/Editor/ReportGeneration/BRT_ReportGenerator.cs(381,41): error CS0117: `SceneManager' does not contain a definition for `GetActiveScene'

    Any idea whats causing this? I downloaded directly from the store page to make sure its up to date.
     
  49. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    Is it possible you have your own class named "SceneManager"? Build Report Tool is making use of Unity's SceneManager, but if you have your own class named SceneManager, the compiler will think it's trying to access that one instead. Try adding "UnityEngine.SceneManagement." before it so that instead of:

    Code (CSharp):
    1. AddAllPrefabsUsedInScene(SceneManager.GetActiveScene().path);
    It would be:

    Code (CSharp):
    1. AddAllPrefabsUsedInScene(UnityEngine.SceneManagement.SceneManager.GetActiveScene().path);
     
  50. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    Hi, I'm not sure what I'm supposed to be looking at in that screenshot. Could you perhaps take a screenshot of your Build Report Window's Options screen? So I can see in the "Editor Log File" part what file it's using?