Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

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. astanid

    astanid

    Joined:
    Apr 5, 2021
    Posts:
    145
    I'm getting 40-60 mb 'unused files' in the report. For example this is report from 'empty' project (i included only one empty scene)
    What is this 62.6 ? It can be just unused assets - cause there're at least 3 gigibytes of unused stuff (extra textures, ui, models etc)

    upload_2022-9-15_0-32-45.png
     
  2. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,546
    Total Unused Assets Size is the sum of all the file sizes listed in the Unused Assets List.


    The Unused Assets list is generated in batches. The default value is 1000, meaning it will only go through the first 1000 files in your project when checking if the file is unused. That might be why your other files are not being included.


    You can browse the next 1000 unused assets by clicking on the next/prev arrow buttons of the Batch in the Unused Assets tab.


    The reason for this feature is that I used to have a customer who had 100,000+ assets and they had a problem where report generation would take something like 30+ minutes because it was collecting the file sizes of all the unused among those 100,000+ files.

    I can add an option to disable the batching in an update (meaning it will go through all assets, but that can increase report generation time for big projects). For now, you can simply set the batch value to a very high number like 99999999999.
     
    astanid likes this.
  3. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,546
    I released a minor version update 3.9.5: I've added an option to disable the batching when checking for Unused Assets:


    This is still turned on by default so you need to uncheck it to disable it.

    Also note that the options of the Build Report is saved on a per-project basis by default, so you'd need to uncheck it for every project you don't want it on.

    The alternative is to move the BuildReportToolOptions.xml file from your ProjectSettings folder into the UnityBuildReports folder of your My Documents, to act as a global options file. The only thing you need to do is make sure there is no BuildReportToolOptions.xml file in the project (because that one takes priority). You can check which options file is being used from the Options tab:


    Also the default value for the asset count for the batches is increased from 1,000 to 10,000.

    The Size Stats will now also display a warning to clarify if batching was used for the total unused size:


    CC: @astanid
     
    astanid likes this.
  4. Stormer2020

    Stormer2020

    Joined:
    Sep 14, 2020
    Posts:
    90
    Why BuildReport packaged in build? Can I exclude it? Thank you~
    version 3.9.5
     

    Attached Files:

  5. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,546
    Yes it's in the Options:

     
  6. Stormer2020

    Stormer2020

    Joined:
    Sep 14, 2020
    Posts:
    90
    Cool! Thank you~
     
  7. joconnormz

    joconnormz

    Joined:
    Jun 8, 2022
    Posts:
    2
    i see a crash if you build via CLI and specify a stdout logfile `-logFile -`. On a fresh machine the Editor.log file does not exist, and logs are routed to stdout.

    see stack

    Code (CSharp):
    1. INFO: - 11/08/2022 04:15:10 PM - FileNotFoundException: Could not find file "/Users/jenkins.svc/Library/Logs/Unity/Editor.log"
    2. INFO: - 11/08/2022 04:15:10 PM -   at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <1fe4b731108247d3a7e57fad336611b9>:0
    3. INFO: - 11/08/2022 04:15:10 PM -   at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <1fe4b731108247d3a7e57fad336611b9>:0
    4. INFO: - 11/08/2022 04:15:10 PM -   at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
    5. INFO: - 11/08/2022 04:15:10 PM -   at System.IO.File.Open (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <1fe4b731108247d3a7e57fad336611b9>:0
    6. INFO: - 11/08/2022 04:15:10 PM -   at DldUtil.BigFileReader.SeekAllText (System.String path, System.String[] seekText) [0x00000] in /Users/jenkins.svc/jenkins-slave/workspace/Ares_Internal_ClientBuild/iOS/areslfs/ares_unity/Assets/ThirdParty/BuildReport/Scripts/Editor/Utility/DldUtil_BigFileReader.cs:88
    7. INFO: - 11/08/2022 04:15:10 PM -   at BuildReportTool.ReportGenerator.GetBuildTypeFromEditorLog (System.String editorLogPath, System.String buildTypeKey) [0x00000] in /Users/jenkins.svc/jenkins-slave/workspace/Ares_Internal_ClientBuild/iOS/areslfs/ares_unity/Assets/ThirdParty/BuildReport/Scripts/Editor/ReportGeneration/BRT_ReportGenerator.cs:515
    8. INFO: - 11/08/2022 04:15:10 PM -   at BuildReportTool.ReportGenerator.GetBuildTypeFromEditorLog (System.String editorLogPath) [0x00000] in /Users/jenkins.svc/jenkins-slave/workspace/Ares_Internal_ClientBuild/iOS/areslfs/ares_unity/Assets/ThirdParty/BuildReport/Scripts/Editor/ReportGeneration/BRT_ReportGenerator.cs:503
    9. INFO: - 11/08/2022 04:15:10 PM -   at BuildReportTool.Util.SaveUnityBuildReportToCurrent (UnityEditor.Build.Reporting.BuildReport report) [0x00007] in /Users/jenkins.svc/jenkins-slave/workspace/Ares_Internal_ClientBuild/iOS/areslfs/ares_unity/Assets/ThirdParty/BuildReport/Scripts/Editor/Utility/BRT_Util.cs:257
    10. INFO: - 11/08/2022 04:15:10 PM -   at BuildReportTool.ReportGenerator.OnPostprocessBuild (UnityEditor.Build.Reporting.BuildReport report) [0x0004e] in /Users/jenkins.svc/jenkins-slave/workspace/Ares_Internal_ClientBuild/iOS/areslfs/ares_unity/Assets/ThirdParty/BuildReport/Scripts/Editor/ReportGeneration/BRT_ReportGenerator.cs:400
    11. INFO: - 11/08/2022 04:15:10 PM -   at UnityEditor.Build.BuildPipelineInterfaces+<>c__DisplayClass18_0.<OnBuildPostProcess>b__1 (UnityEditor.Build.IPostprocessBuildWithReport bpp) [0x00000] in /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:458
    12. INFO: - 11/08/2022 04:15:10 PM -   at UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPair[T1,T2] (System.Collections.Generic.List`1[T] oneInterfaces, System.Action`1[T] invocationOne, System.Collections.Generic.List`1[T] twoInterfaces, System.Action`1[T] invocationTwo, System.Boolean exitOnFailure) [0x000ff] in /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:402
    13. INFO: - 11/08/2022 04:15:10 PM - UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
    14. INFO: - 11/08/2022 04:15:10 PM - UnityEngine.DebugLogHandler:LogException(Exception, Object)
    15. INFO: - 11/08/2022 04:15:10 PM - UnityEngine.Logger:LogException(Exception, Object)
    16. INFO: - 11/08/2022 04:15:10 PM - UnityEngine.Debug:LogException(Exception)
    17. INFO: - 11/08/2022 04:15:10 PM - UnityEditor.Build.BuildPipelineInterfaces:InvokeCallbackInterfacesPair(List`1, Action`1, List`1, Action`1, Boolean) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:415)
    18. INFO: - 11/08/2022 04:15:10 PM - UnityEditor.Build.BuildPipelineInterfaces:OnBuildPostProcess(BuildReport) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:456)
    19. INFO: - 11/08/2022 04:15:10 PM - UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[], Boolean)
    20. INFO: - 11/08/2022 04:15:10 PM - UnityEditor.BuildPipeline:BuildPlayerInternal(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[]) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline.bindings.cs:448)
    21. INFO: - 11/08/2022 04:15:10 PM - UnityEditor.BuildPipeline:BuildPlayer(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[]) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline.bindings.cs:347)
    22. INFO: - 11/08/2022 04:15:10 PM - UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline.bindings.cs:321)
     
  8. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,546
    Ok thanks, I'll look into it in the coming weekend. I'll try to work around this. I'll see if it's possible to make make Build Report Tool read off of stdout.

    I think for now to get rid of that exception, you can assign a dummy empty text file as the custom override log file from the Options. It won't fix it, but at least it'll stop the exception from happening.

     
  9. Johny-Gull

    Johny-Gull

    Joined:
    Apr 22, 2014
    Posts:
    13
    Hi

    I have to tell you in advance that I have been using your Asset for a long time, not a single project is without it. Thank you very much :)
    But suddenly it stopped working for me, gives out only UBR- files. I got used to them, because as far as i understood, it is standard: it creates these files and a usual log, which I open.
    Unity 2022.2.0f1, but that's not it. Checked it on a clean project, everything is fine. Build Report Tool version 3.9.6

    I'm sure it's me clicking or disabling something somewhere in settings or preferences and now nothing is working. Maybe you can tell me which option in Unity is important for your tool?
     

    Attached Files:

  10. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,546
    In the Build Report Tool window, it the Options, this setting controls whether to save the build report or not:


    Then if you scroll down, these additional checkboxes control whether to save the extra files:



    If you want to make sure, just delete the "BuildReportToolOptions.xml" file in your ProjectSettings folder, and Build Report Tool will create a new options file with default values the next time it is opened:
     
  11. scorp2007

    scorp2007

    Joined:
    Aug 17, 2014
    Posts:
    54
    Hello! Its work for WebGL?
     
  12. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,546
    Version 3.10 released: This update is due to a user request, but I might as well mention it here. This is for automated builds for those who use Build Report generation in their build scripts.

    BuildReportTool.ReportGenerator.CreateReport() can now be specified with the folder to save the Build Report XML files to.

    Custom Extra Data can now be included in a Build Report. You can use this, for example, to record what git commit ID was used for a certain build.

    Code (CSharp):
    1. // Note: last argument is new, it lets you specify the path to the folder where you want the Build Report XML files to be saved to.
    2. // Note 2: for brevity, just assume buildPlayerOptions already exists
    3. string pathToBuildReport = BuildReportTool.ReportGenerator.CreateReport(buildPlayerOptions, null, "C:/Temp");
    4.  
    5. // This is the full path and filename that the extra data needs to be saved to,
    6. // in order to be recognized as the extra data for this Build Report.
    7. // This is going to be a text file (it ends in .txt).
    8. string extraDataFilename = BuildReportTool.Util.GetExtraDataFilename(pathToBuildReport);
    9.  
    10. // You can put just plain text, or any markup that Unity supports
    11. // (https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/StyledText.html)
    12. string extraDataExampleContent = @"<size=30>Test Header 1</size>
    13.  
    14. Test
    15. <b>bold</b>: <i>italic</i>
    16.  
    17. <size=30>Test Header 2</size>
    18.  
    19. <color=#ff0000ff>red</color>, <color=#00ff00ff>green</color>, <color=cyan>blue</color>";
    20.  
    21. // Use any way you prefer when saving the contents of the extra data.
    22. System.IO.File.WriteAllText(extraDataFilename, extraDataExampleContent);
    So the way it works is you have to use BuildReportTool.Util.GetExtraDataFilename() on the string returned by BuildReportTool.ReportGenerator.CreateReport() to get the path and filename for the extra data. You will need to create the text file yourself and save it to that path and filename.

    That will be an extra text file alongside the Build Report XML, it will have "ExtraData-" at the beginning of the filename.

    When opened, you'll get a new tab called "Extra Data" after the "Size Stats" tab.

    This is how that sample string data will look like in the Build Report window:



    Sorry for the late reply but yes, it should work. If you buy it, let me know if it doesn't work for you.
     
  13. fendercodes

    fendercodes

    Joined:
    Feb 4, 2019
    Posts:
    190
    hi @AnomalusUndrdog - thanks for a great asset. There are a few script warnings when using the asset on Unity 2022.2. Just thought I'd flag them for you for the next update. This is just an example of one, but there's a bunch that are similar:

    Assets\BuildReport\Scripts\Editor\ReportGeneration\BRT_TextureDataGenerator.cs(169,30): warning CS0618: 'TextureImporter.spritePackingTag' is obsolete: 'Support for packing sprites through spritePackingTag has been removed. Please use SpriteAtlas instead.'
     
    AnomalusUndrdog likes this.
  14. unity_48BD336C42956E39F190

    unity_48BD336C42956E39F190

    Joined:
    Jun 9, 2021
    Posts:
    2
    Hello @AnomalusUndrdog

    I'm having an issue where the apk size is 140 but the total of the used assets is only ~40mb... Screenshot 2023-07-27 120638.png
     
  15. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,546
    Yeah that's strange, I built an empty project in Unity 2021.3.23f1 to Android and it was only 49 MB. Can you try doing that too and see if you get the same size?



    You can also try using any zip archive program (such as 7-zip) to open the contents of the apk file (an apk is really just a zip file). For example, in the empty project I built, the reason it was 49 MB was due to the .dll and .so files.

     
  16. unity_48BD336C42956E39F190

    unity_48BD336C42956E39F190

    Joined:
    Jun 9, 2021
    Posts:
    2
    I've checked it using 7-zip and it's ~140mb, some of it is because of the assets and some because lib...
     
  17. Johny-Gull

    Johny-Gull

    Joined:
    Apr 22, 2014
    Posts:
    13
    Hi
    I am in the process of optimizing a finished project that i have not worked in before and i added Build Report Tool right away before i started working, but during the import an error

    Assets\BuildReport\Scripts\Editor\Window\Screen\BRT_BuildStepsScreen.cs(1035,57): error CS1501: No overload for method 'GetType' takes 1 arguments


    Unfortunately, I don't know what settings were changed during development, i compared Project Settings/Player/Other and Project Settings/Editor with the ones i have in my project without errors, everything is identical.
    Can you tell me what this could be related to? What settings are needed? Maybe it conflicts with some packages?
     

    Attached Files:

  18. fegabe

    fegabe

    Joined:
    Jan 3, 2015
    Posts:
    18
    Hello,

    I've purchased the plugin because it looks great and the reviews are awesome and sadly I'm having an issue jus trying to make it work. I'd love to use since it'll really help me trying to find what's going on with my builds, I hope you can shed some light on the issue.

    I couldn't find others in this forum happening the same so I don't know what could be happening. Maybe is becuase I'm using macOS?

    What I do is making a build and after that going to the plugin's window and try to open the xml log file manually and this is what I got (I'm also attaching the generated XML).

    CleanShot 2023-07-31 at 13.32.44 2@2x.png

    Thank you very much!
     

    Attached Files:

  19. GayanUthpala

    GayanUthpala

    Joined:
    Feb 3, 2016
    Posts:
    6
    Hi...

    Assets\BuildReport\Scripts\Editor\ReportGeneration\BRT_UnityBuildSettingsUtility.cs(462,42): error CS0619: 'EditorUserBuildSettings.webGLUsePreBuiltUnityEngine' is obsolete: 'Building with pre-built Engine option is no longer supported.'
    Assets\BuildReport\Scripts\Editor\ReportGeneration\BRT_UnityBuildSettingsUtility.cs(522,67): error CS0117: 'EditorUserBuildSettings' does not contain a definition for 'wsaGenerateReferenceProjects'

    Unity version 2019.2

    how can i fix this?
     
  20. SalchipapasGames

    SalchipapasGames

    Joined:
    Sep 8, 2018
    Posts:
    7
  21. SloppyStudios

    SloppyStudios

    Joined:
    Jul 24, 2023
    Posts:
    1
    hi @AnomalusUndrdog,
    just Install the build Report tool, but I am not being able to use the tool, when the build is finished nothing is automatically displayed, and when I try to get log it gives me the following warning:
    Build Report Tool: No build info found. Build the project first. If you have more than one instance of the Unity Editor open, close all of them and open only one.

    and then if i use the open log, an error :
    Build Report Tool: Invalid data in build info file: /Users/###/UnityBuildReports/game-Android-2023Nov04-110640.xml
    #0 GetStac

    any idea how to fix these ? thanks
     
  22. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,546
    I'm pretty sure I fixed those way back in 2019 (version 3.4.14 of Build Report Tool).

    Those lines of code already have #if checks, as in:

    This basically means it only compiles in Unity 5.4 to 2018.4
    Code (CSharp):
    1. #if UNITY_5_4_OR_NEWER && !UNITY_2019_1_OR_NEWER
    2.             settings.WebGLUsePreBuiltUnityEngine = EditorUserBuildSettings.webGLUsePreBuiltUnityEngine;
    3. #endif
    This means it only compiles in Unity 5 to 2018.4
    Code (CSharp):
    1. #if !UNITY_4 && !UNITY_2019_1_OR_NEWER
    2.         settings.WSAGenerateReferenceProjects = EditorUserBuildSettings.wsaGenerateReferenceProjects;
    3. #endif
    Are you sure you're on the latest version of Build Report Tool?
     
  23. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,546
  24. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,546
    Build Report Tool will report this error if it can't find build info in the Editor.log.
    It will look for the text "Used Assets and files from the Resources folder, sorted by uncompressed size:"

    If you manually open your Editor.log file just right after making a build (cause it'll be gone once you close and re-open Unity), try checking if that line of text is present. It would look something like this:


    Though I did recently fix a bug with the Linux version using the wrong path to the Editor.log. If you're using Linux, try it again after that update goes live.

    I've had users report this kind of error.
    It will report this error if the xml file is empty or has missing crucial data, which might happen if an earlier error prevented Build Report Tool from executing further. It's probably happening due to the first error you mentioned.
     
  25. nekoneko777

    nekoneko777

    Joined:
    Sep 11, 2013
    Posts:
    45
    Hi, thanks for this tool. This has been tremendous help for the optimization process.
    One question I have, the build report tells me the size of the build is 1.72GB lol so I need to cut down obviously.
    One of the reasons is the sprite atlas, currently it contains many large sprites so I expected them to be showing up in the used asset tab but no sprite atlas textures (expect 4k textures) showing up. not only the sprite atlas, none of TGA, PNG are showing up.
    When I set the "Texture" filter, only 23 PSD files.
    In fact, it was showing up when I tried before, but for some reasons, it stopped showing any textures in the used asset tab lately. Any idea what's causing it? Did I misconfigure something?
    I use Addressables system, and confirmed the sprite atlas is not added to the addressables.
    Any suggestion is appreciated. thanks
     
    Last edited: Nov 22, 2023