Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Significant build size increase, when updating to Unity 2022, 2023, or Unity6

Discussion in 'Web' started by kreso, May 1, 2024.

  1. kreso

    kreso

    Joined:
    Sep 7, 2013
    Posts:
    152
    Hello,

    After upgrading from 2021 to 2022 or 2023 (or Unity 6) WebGL build size goes up dramatically.

    My initial game's (2021.3) build is 7.8MB compressed.
    After upgrading to 2022, it gets about 20% more size to final build.

    After upgrading to Unity6_preview (either from 2022, or directly from 2021) build size goes to 11MB.

    About extra 3MB appear out of nowhere.

    There is nothing in the package manager.
    There is absolutely no meaningful reason from the build report.
    I tried reimporting everything, deleting build folder, deleting Temp folder, clean build, etc...
    There should be no reason - but the problem is there.

    Did anyone else run into this issue?

    Kind regards,
    Kreso
     
  2. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,462
    You're moving to a new release that has new features in the runtime. For example Unity 2022 added support for Entities to WebGL. Entities is in a package but the package requires certain features that have to be provided by the runtime.
     
    Last edited: May 1, 2024
    bugfinders likes this.
  3. roka

    roka

    Joined:
    Sep 12, 2010
    Posts:
    601
    Editor.log is one of your best friend in this case
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,444
    No but you can make a simple test: create new, empty projects in both editor versions and build for WebGL and check the difference. If it's notable you could send a bug report.
     
    kreso likes this.
  5. kreso

    kreso

    Joined:
    Sep 7, 2013
    Posts:
    152
    I did, and I did.

    Thought I would ask here as well, hoped for some ideas.
     
  6. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    449
    Not an issue. If using URP, you need to strip a lot of the shaders. Take a look at this for cues on how to minimize your build size / overall best practices.



    Our compiled brotli-compressed Unity 6 player with many packages & URP 3D, is 8MB total.
     
  7. Lemovision

    Lemovision

    Joined:
    Apr 6, 2020
    Posts:
    39
    I agree that with the focus on mobile WebGL support, Unity 6 should make it easier for us to get a smaller build, instead a bigger build in this version!
    It's still extremely hard for the average dev if you have to do micro-management of every single setting to save a few kilobytes here and there
    And with long build times for web platform it's just a very tedious process to try every setting
    Any way to have a build size estimation tool somewhere before building and while adjusting settings?
     
  8. kreso

    kreso

    Joined:
    Sep 7, 2013
    Posts:
    152
    I am using built in renderer, most rudimentary packages.
    Nothing shows up in the build report (no new shaders etc...).
     
  9. kreso

    kreso

    Joined:
    Sep 7, 2013
    Posts:
    152
    I'm using Build report tool: https://assetstore.unity.com/packages/tools/utilities/build-report-tool-8162
    And Project Auditor: https://github.com/Unity-Technologies/ProjectAuditor

    Hope it helps!
     
    Lemovision likes this.