Search Unity

Question about 'pack together by label'

Discussion in 'Addressables' started by Patrick_PS, Jan 28, 2020.

  1. Patrick_PS

    Patrick_PS

    Joined:
    Sep 9, 2019
    Posts:
    154
    Considering the following scenario: I have 2 addressable groups. The first one contains 2 scenes (map1, map2) that have labels of the same name. The second addressable group contains a sprite (spriteA) that is used by both scenes. spriteA has the labels "map1" and "map2".

    Question: If I set the second addressable group to 'pack together by label', will the addressables system build a bundle containing all assets that have the 2 labels ("map1" and "map2") or will it create a bundle for all assets with the label "map1" and another bundle containing all the assets with the label "map2" thereby duplicating spriteA?
     
  2. CameronND

    CameronND

    Joined:
    Oct 2, 2018
    Posts:
    89
    I also want to know the answer to this
     
  3. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    586
    This seems like something that is very easy to test.

    Just from conjecture, I think the pack mode works on a per-group basis, so it will build bundles with "group1_map1", "group1_map2", "group2_map1", "group2_map2" or something like that. But you should test it yourself.

    [EDIT] I'm also pretty sure any asset that is marked addressable will not be duplicated (unless it's also built into the engine).
     
  4. Patrick_PS

    Patrick_PS

    Joined:
    Sep 9, 2019
    Posts:
    154
    I did try it out and found out that the addressable system will create a bundle named "XXX_map1map2_XXX".

    But when I scaled it up I noticed that a bundle named "XXX_map1map2_XXX" and another one named "XXX_map2map1_XXX". I think this is not a big issue but it is a bit confusing.
     
  5. CameronND

    CameronND

    Joined:
    Oct 2, 2018
    Posts:
    89
    I also tried it and it does look like it groups assets together that share the same set of labels.
    However one thing to be careful about it having too many labels on on addressable can result in exception that the file name is too long because unity appends the labels to the bundle names.
    I got around it by setting bundle naming rule to be 'hash of bundle'.