Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

Feedback Improving bundle load speed by loading all assets at once?

Discussion in 'Addressables' started by Adrien_Danglard, Jun 28, 2020.

  1. Adrien_Danglard


    Nov 4, 2019
    Digging into the source code of the package, I noticed that BundledAssetProvider uses AssetBundle.LoadAssetWithSubAssetsAsync to load each asset in a bundle. Supposing that I need _all_ assets in a bundle to be loaded - e.g. because they contain assets referenced by a scene -, would it not be better to call LoadAllAssetsAsync right after the bundle is loaded, instead of making a separate async call for each of the assets? Would this not improve loading times?

    TL;DR: I think it would be awesome to be able to designate groups as "when you load this bundle, load all assets from it in one go," to achieve better loading performance. (Unless there's some underlying reason that I'm not aware of, which would make this impossible.)
  2. phobos2077


    Feb 10, 2018
    Actually I did have a performance issue loading >1000 assets from a bundle on Android. I tried all combinations (sync vs async load, loading all assets vs loading one by one) and in my tests the only combination that was slow as hell (like 2-4 times slower) was loading all assets one by one asynchronously, how Addressables do it by default.

    I recommend writing a custom BundledAssetProvider and trying all 4 combinations and see how it performs in your particular game. In my case I've wrote a Sync version of this provider that loads assets one by one (so the calling side didn't change) but using the Sync API of AssetBundle. This fixed the slow loading problem and ended up being nearly identical to calling LoadAllAssets from AssetBundle.

    For Addressables package itself, I agree that it should auto-detect at runtime that your LoadAssetsAsync request actually needs to load everything from a bundle and use different API instead. That seems like a reasonable optimization they should do at some point.
    zyc_dc and Adrien_Danglard like this.