Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Question on Addressable

Discussion in 'Addressables' started by najongjine_unity, Mar 13, 2023.

  1. najongjine_unity

    najongjine_unity

    Joined:
    Oct 29, 2019
    Posts:
    19
    Currently, my use of addressable knowledge is novice.



    I have successed on loading a map and related decorations through addressable's
    InitializeAsync method.

    I'm thinking to implent enomorous items through addressabe's download system from server
    and spawn it in runtime.


    1. Does addressable's making new group have limitation? Like 255 group names are limit like that?

    2. Let's say I made sword1~100, and bow1~100 and moved to weapon group.

    When I spawn sword1, does it download whole weapon group file and store in memory first, then take out

    sword1 from the weapon data inside the memory?
     
  2. LuGus-Jan

    LuGus-Jan

    Joined:
    Oct 3, 2016
    Posts:
    179
    Not directly. You can have a pretty large amount of groups. This does have an effect on catalog size, as each group is registered in there, and depending on the packing method (everything in one bundle, or one bundle per entry).

    The 255 characterlimit is a limit only on Windows. You can enable it to use larger file names. Alternatively, you can adjust the naming scheme of groups to limit the name of the built bundles, e.g. 'Use Hash of Filename' will create names that are all equally long.

    Depends on the packing again, but generally, it's best to group items that logically belong together.
    If you put 100 different swords in a single group and they are packed in a single bundle, then it will download this whole bundle. Loading in memory is a different matter and depends on the compression algorithm being used. Using no compression or LZ4 compression will allow to extract just the single items that are required. Using LZMA uses better compression (better for downloads) but will need to load the whole file into memory to decompress it and extract the items. So it's a trade-off between download/disk size versus memory usage.

    So I would create one group per sword (including prefab, materials, textures, etc.).
     
  3. najongjine_unity

    najongjine_unity

    Joined:
    Oct 29, 2019
    Posts:
    19

    I have question on download. When the client's unity app download a bundle (using Addressables.InstantiateAsync() ), does it permanently stores it somewhere? Or it's one time download and it's automacally deleted on client's storage?
     
    Last edited: Mar 14, 2023
  4. LuGus-Jan

    LuGus-Jan

    Joined:
    Oct 3, 2016
    Posts:
    179
    I haven't used remote loading of bundles yet, but as far as I understand, it's placed in cache location. So the bundle file keeps existing for a while. Depending on where this cache folder is located, it might get cleared if storage space on the device is running low, or a cleanup task on the system is started.