unity-game-engineassetbundleaddressables

How to download only changed files from an Addressable system in Unity


I'm working on a game that uses Addressable.

I'm using the Group feature of Addressable to keep the AssetBundle as small as possible.

I recently realized that even if I change just one file, I need to download the entire AssetBundle that contains it. Since the minimum unit of Addressable is AssetBundle, it seems that if a file in an AssetBundle is changed, I can't just get the changed file, but the entire AssetBundle that contains it.

I want to solve this problem, I want to change the system so that if there is only 1 changed file, only that file is downloaded. So I'm trying to figure out how to look inside the AssetBundle and put externally downloaded files from Unity into the AssetBundle. Is this the right way to approach it? If not, I may have to build a new system from scratch that doesn't use Addressable.

Is it possible to manually manipulate the internals of the AssetBundle in an environment like this using Addressable, so that only the changed files are downloaded, and then try to build a system that works correctly?

Thank you.


Solution

  • An AssetBundle as the Name suggests is a bundle of multiple assets. Imagine it like a ZIP archive file.

    => From the outside you only see that the entire bundle changed. At this stage you don't know any individual files. You only would see that only one file changed after downloading and unpacking the entire bundle.


    You should group and pack your assets properly according to your needs - usually you want to group them together if they belong together and are likely to change together.

    In your case you might want to go for the Advanced Setting

    Bundle Mode
    How to pack the assets in this group into bundles:

    • Pack Together: create a single bundle containing all assets.
    • Pack Separately: create a bundle for each primary asset in the group. Subassets, such as Sprites in a Sprite sheet are packed together. Assets within a folder added to the group are also packed together.
    • Pack Together by Label: create a bundle for assets sharing the same combination of labels.

    Afaik Pack Together is the default and is what you are describing.

    => You would probably rather want to Go for Pack Separatly so that each root asset sits in an individual AssetBundle.