Search Unity

Best way to load list of AssetReferences

Discussion in 'Addressables' started by AndersonDev, Jul 1, 2019.

  1. AndersonDev

    AndersonDev

    Joined:
    Dec 13, 2015
    Posts:
    70
    Hi, I want to achieve something like this without iterating throw all list and loading each asset separately:
    Code (CSharp):
    1. public List<AssetReferenceSprite> Icons;
    2.  
    3. IconsHandle = Addressables.LoadAssetsAsync<Sprite>(Icons, _ => { });
    4. IList<Sprite> icons = await IconsHandle.Task;
    Thanks!
     
  2. AndersonDev

    AndersonDev

    Joined:
    Dec 13, 2015
    Posts:
    70
    One way I have found:
    Code (CSharp):
    1. IconsHandle = Addressables.LoadAssetsAsync<Sprite>(new List<object>(Icons), null, Addressables.MergeMode.Union);
     
    unity_bill likes this.