Search Unity

Addressable Group Memory question

Discussion in 'Addressables' started by lifetree, Jun 27, 2019.

  1. lifetree

    lifetree

    Joined:
    Mar 28, 2014
    Posts:
    47
    Hi, I asked this Q over on Stack Overflow, but I haven't gotten any replies for some reason. Simple question about memory regarding groups when loading addressables:

    In our Unity game, we are creating a 2D first person game (Myst-style), so we naturally have many many Texture2Ds. We didn't think much of it until we starting experiencing crashes on older iOS devices due to memory issues. So I need to change the loading of Texture2Ds from all at once in the scene to instead be loaded on the fly at runtime using addressables.

    I watched the 2018 lecture on addressables, but he didn't seem to answer my main question, which is: If I were to have all my textures in one group and I load just one texture, will it load the entire group, and thereby put all of the group into memory?

    I need to know whether it is okay to have them in the same group (or whether grouping makes a difference in memory) or whether I would need to make the groups much smaller for memory efficiency. If the latter would be the case, would it just be better time-wise to use Resources.LoadAsync()?
     
  2. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    311
    No, addressable are just asset bundle compressed via LZ4 by default. LZ4 format does not require the entire bundle to be decompressed to load specific asset. See more in AssetBundleCompression.

    Group is a logic unit to organize asset. By default a group packs into an asset bundle (for distribution). But you can change it to pack-per-unique-label or pack-per-asset, which results in more but smaller asset bundles per group. As said it's about distribution (download via network), and has nothing to do with loading. Loading asset are always on demand with LZ4 format.
     
    unity_bill and lifetree like this.
  3. lifetree

    lifetree

    Joined:
    Mar 28, 2014
    Posts:
    47
    Perfect, that is what I needed to know. Thanks so much for your concise and informative answer!