Search Unity

Question Profiling addressable loading time

Discussion in 'Addressables' started by sebas77, Apr 29, 2021.

  1. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,642
    Hi,

    I read everything I could find on google about addressables. Some things are clear, some others are not. In general, it is not clear how to profile the loading times and what the best settings for each situation are. In our case, I am looking for the best settings for a desktop game that doesn't need addressable to be updated after the release.

    Weird thing is that the loading times vary wildly. from 10 seconds to 90 seconds (on a surface pro).

    I am experimenting with:

    - no compression
    - contiguous bundle
    - no crc check

    I have doubts about:

    how to best group/loading these groups
    package grouped vs package separately

    Fundamentally I think that if I package each group in one file, the best thing to do would be to load the whole file/group at once. Currently instead while we have a dozen of groups, our code is full of

    Addressables.LoadAssetAsync

    and just a bunch of

    Addressables.LoadAssetsAsync

    that happen to coincide with the group

    Desperately seeking advice :)
     
  2. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,642
    I also wonder if loading a preloaded asset will load it again or get it from the cache

    Would something like the following effectively precache data in memory for subsequent addressable loading?

    Code (CSharp):
    1.  public static IEnumerator<TaskContract> PreloadAssets()
    2.         {
    3.             //find all the locations with label "SpaceHazards"
    4.             AsyncOperationHandle<IList<IResourceLocation>> loadResourceLocationsHandle =
    5.                 Addressables.LoadResourceLocationsAsync("asset", typeof(UnityEngine.Object));
    6.             while (!loadResourceLocationsHandle.IsDone)
    7.                 yield return Yield.It;
    8.                  
    9.             //start each location loading
    10.             AsyncOperationHandle<IList<Object>> opList = Addressables.LoadAssetsAsync<UnityEngine.Object>(loadResourceLocationsHandle.Result, null);
    11.          
    12.             //create a GroupOperation to wait on all the above loads at once.
    13.             while (!opList.IsDone)
    14.                 yield return Yield.It;
    15.  
    16. }
    is it faster to use LoadAssetsAsync on multiple groups or it's faster on one giant group?
     
    Last edited: Apr 29, 2021