Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Asking for advice how to manage Asset Groups

Discussion in 'Addressables' started by Peter77, Apr 11, 2021.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,444
    I created myself a major workflow issue with how I manage Groups in the Addressables Groups window.

    We have a character editor that allows to choose between a lot of different variations. I want each of these asset variations to be stored in a separate asset group. Each variation is stored in its own sub-directory and contains one or multiple assets. I want to store them in separate bundles to:
    • Have finer memory control over them
    • Add new content to the game without having to rebuild existing asset groups
    • Change existing content without having to rebuild other existing asset groups (faster build times)
    However, the way I add asset groups to the project is extremely tedious and takes a lot of time.

    In the following video I explain the issue I'm facing.
     
  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,444
  3. apkdev

    apkdev

    Joined:
    Dec 12, 2015
    Posts:
    263
    Peter77 likes this.
  4. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,444
    Thank you for the reply.

    I just tested the "Pack Separately" option, but I don't understand what it's doing. According to the documentation:
    ... I assumed when I add the "body" directory as shown in the video, it would store the content of each sub-folder to a separate bundle. This isn't the case though.

    This is the project structure:
    upload_2021-4-19_7-48-11.png


    I added the "Assets/art/body" and "Assets/art/hair" directories to the Addressables Groups window and changed their "Bundle Mode" to "Pack Separately":

    upload_2021-4-19_7-49-8.png

    Then I ran the "Clean Build > All" and "New Build > Default Build Script" steps. This created the following bundles...

    What's different is that Addressables now stores the bundles in directories:
    upload_2021-4-19_7-50-59.png


    But each directory just contains one bundle where all assets are stored together:
    upload_2021-4-19_7-51-21.png

    I assumed (or hoped) that Addressables would create a bundle for every directory that's located directly under "Asserts/art/body". So that I would find bundles for "body_01", "body_01_01", "body_02" etc.
     
  5. apkdev

    apkdev

    Joined:
    Dec 12, 2015
    Posts:
    263
    That's how I would interpret that description as well, but as far as I've figured out, adding folders to addressables forces them into the same bundle. You should try adding each asset separately. Currently I'm using a modified version of Unity Addressable Importer to automatically add all assets in given directories.
     
  6. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,796
    Flagging for the team to have a look!
     
    apkdev and Peter77 like this.
  7. andymilsom

    andymilsom

    Unity Technologies

    Joined:
    Mar 2, 2016
    Posts:
    294
    Pack separately certainly sound like what you need.
    I can see why that is confusing. To take your case here, you added "Assets/art/hair" folder to the Group, this is now an entry. With pack separately every entry will be a bundle. All sub entries to be taken into a single bundle in this case is then "Assets/art/hair/hair_01" "Assets/art/hair/hair_01_01" etc all together.
    What you are looking for is to assign the folders as an entry. Where each folder you add, you want it to become its own bundle. So: "Assets/art/hair/hair_01_01" "Assets/art/hair/hair_01_02" etc to a Group with pack separately.

    For the other aspects you mentioned in the video,
    Dragging multiple entries to reorder not working. This is a bug, we have fixed this and will be in an upcoming release.
    For sorting, that is done on the Entries, not the Groups. Groups order is more under control of the user.
    For selecting the group and the Asset being selected, this is to allow for the inspector to show Group settings. We have a ticket to look into any options available when selecting assets, as you may not need to select the asset itself and show the asset in the inspector when in the groups window. I have added a comment to this to extend it to Groups, and see if there is a better UX that could be improved for selecting the Group, however it does still need to be selected to show the settings in the inspector.
    For clicking Create New Group -> Packed Assets. We have a templates feature in the Addressables settings. By default the only template added is for local packed assets. This is useful for many users where you make a lot of Groups and have a set of different settings.

    With your setup you may also be interested in organising the Groups. This is done using the '-' character (needs to be enabled in the settings). If you name your groups something like
    "characters-hair" "characters-body" for example, then they will be under "characters" in the window hierarchy. This may not be as useful if you using pack separately with the folders at the current scale in the video.
     
    apkdev likes this.
  8. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,444
    Thank you for the reply @andymilsom.

    Yes, this helps somewhat. But what I'm really looking for is to add a single folder to a Group ("Assets/art/hair/") and Unity creates a separate assetbundle for each subfolder ("Assets/art/hair/hair_01_01", "Assets/art/hair/hair_01_02", etc).

    If this isn't supported yet, the question becomes:
    1. Can you support this? It certainly makes managing content a lot easier!
    2. Can I implement it myself, by extending Addressables without changing the package code itself?

    "Packed Assets" is probably the one that's used the most. Makes sense to organize the UI around "what's used most" to me.

    Thank you, I wasn't aware of this option.
     
    Last edited: Apr 27, 2021
    phobos2077 likes this.
  9. andymilsom

    andymilsom

    Unity Technologies

    Joined:
    Mar 2, 2016
    Posts:
    294
    I wouldn't really say this is good addition. Double Pack Separately can be useful in cases like your own, I think could easily create mistakes with usage, like adding a folder full of Asset, and then expecting them packed together.
    I'll discuss custom packing methods with the team, see if there is anything we would want to pursue in this regard.

    You can edit the code, it's all open. It is all inside the package, so you will need to make your edits to a copy of the package.
     
  10. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,444
    Thank you for the reply.

    I used the "Pack Separately" setting for a couple of months by now and I can tell you with confidence, that using a "Double Pack Separately" setting would help me with the groups setup and maintenance significantly.

    Right now, every time an artist adds a new "hat" for example, someone with a more technical background must update the Addressables group by hand.

    The "Double Pack Separately" setting definitely would be a good addition for me. That's why there exist different Bundle Mode settings in the first place I would think, to cover different use-cases.
     
    apkdev likes this.
  11. Jribs

    Jribs

    Joined:
    Jun 10, 2014
    Posts:
    154
    You can automate generating groups with an editor script. I would recommend going that way. Then everytime someone adds new art you press a button and it manages the groups however you like.

    Theres a lot of ways you could do it, but even if you just preface folders with certain things you can have a script say something like "if the names prefix is "__hat__", then make a group like this".

    When projects get large, manually managing the groups is an impossibility, you have to make your own automation.
     
  12. phobos2077

    phobos2077

    Joined:
    Feb 10, 2018
    Posts:
    350
    I agree with @Peter77, this should be a setting. Or maybe add ability to set "Pack separately Depth" value per folder-entry in Addressable Group. Because with current functionality to achieve efficient workflow you are required to write custom AssetPostprocessor that will automatically add/move explicit entries to "Pack Separately" groups when you add/move/delete assets in certain folder. But isn't this exactly what Addressables is already doing under the hood anyway? So why add another layer of automation if you can just expand on the existing built-in functionality.
     
  13. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,444
    About a year later and Addressables is still not providing this functionality. Very disappointing.