Search Unity

WebGL Build Size

Discussion in 'Addressables' started by ProtoTerminator, Jan 17, 2020.

  1. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    586
    I just switched my webgl project over to addressables from assetbundles, and I did a build size comparison.

    Assetbundles uncompressed:
    22.1mb
    (code)
    8.5mb
    (data)
    Assetbundles brotli:
    3.3mb
    (code)
    2.6mb
    (data)

    Addressables uncompressed:
    23.7mb
    (code)
    8.8mb
    (data)
    Addressables brotli:
    3.5mb
    (code)
    2.7mb
    (data)

    200kb might not sound like much, but my team has spent a lot of time getting our engine size as small as possible to get load times down, and going from 3.3 to 3.5 is a bigger size jump than I was expecting before I switched to addressables (I also deleted the old AssetBundleManager we were using, so I was expecting around the same size or maybe slightly larger, but not 1.6mb).


    Is there any way to get that size smaller while still using addressables? Currently we're hosting all of our addressable assets remotely, so I would think we wouldn't need any extra data stored in the engine. I see the AddressableAssetsData folder is auto-generated, can I remove that for the build and still receive all the assets remotely? (I would expect so with a remote catalog, but I want confirmation and how to go about this properly.)
     
    Last edited: Jan 17, 2020
  2. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    586
    @DavidUnity3d Is there any way to get this build size smaller? Or that's that and I just have to deal with it?
     
  3. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    Just checking, are you talking about the size of the entire build folder or of specific bundles? Addressables is going to be larger than building Asset Bundles directly because we need to include content state caches, local and (possibly) remote catalogs, etc.
     
  4. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    586
    It seems some other people have figured out how to load addressables built from a separate project by downloading the settings at runtime, so I can possible solve the data size that way.

    Otherwise, I'm still concerned about the code size, by which I'm referring to the
    [project].wasm
    for streaming instantiation or
    [project].wasm.code.unityweb
    for non-streaming.
    I understand you're handling a lot of complexity, but the code size output seems larger than what I would expect. I also took a peek (very quick, not a deep dive) in the package code and noticed a
    using System.Linq;
    which I usually avoid in release code.
     
    Last edited: Jan 23, 2020
  5. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    586
    You mentioned in my other thread that you auto generate a link file to prevent stripping of addressables code. Is that perhaps too aggressive? Is there some code that we can safely strip?
     
  6. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    There may be something that could be done about lowering the overall code size output but it is currently not one of our higher priorities.

    As far as the link.xml it's certainly possible. However, if I remember correctly, we don't add anything in there that isn't critical to run Addressables.

    If you'd like to file a report with Unity we can definitely look into it but I don't imagine it'll be soon. If using data built from a separate project solves your size issue that's probably your best bet at the moment.