Search Unity

Bug Update generates new/unique bundles for groups B and C if we make an one change to asset in group A

Discussion in 'Addressables' started by Prodigga, Feb 12, 2021.

  1. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Case 1312946

    1. What happened
    We have multiple Addressable Groups. Default, Vehicles, Maps. We make change to an asset that resides in the Default group, and this causes Vehicle and Maps bundles to be unique even if we try to do an update. No assets in those groups were altered, we expect the generated bundles to be the same with the exception of the Default group.

    The maps and vehicles bundles are our largest bundles. A simple change (altering the version of a string on an asset in an unrelated addressable group) results in our users having to download 40~ mb's of content!

    2. How we can reproduce it using the example you attached

    - clean build cache
    - New Build: build bundles = Bundle A
    - Edit 'Content Pack Version' asset, change version to 40.0.0
    - Update Previous Build: build bundles = Bundles B, not matching Build A. For example, see
    - Some bundles are unique as expected ('default_assets_gamedatabase.bundle'), but unrelated bundles are also unique ('maps_scenes_industry.bundle' and all 'vehicles_assets_*.bundle's)
     
  2. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
    Thanks for submitting the bug report!
     
    Prodigga likes this.
  3. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Been 2 weeks since I submitted the bug report and not so much as an acknowledgement on the tracker. (Bug reported 8th of February)

    This is a really concerning bug, because it would be prohibitively expensive to use addressables if it turns out this is "expected behaviour" of some sort. Id like to know sooner rather than later!

    Something as simple as changing the value of a string in one asset group should not result in the user needing to redownload a majority of the game content.
     
  4. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
    Apologies for the delay! I'm chasing down an update for you now.
     
  5. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Cool, that's ok, thanks so much for replying and chasing it up.
     
  6. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    The issue was rejected

    I will have to resubmit for review in 2020.2. We were waiting for LTS before we updated our project. I can't imagine the issue would just go away, though. Fingers crossed I guess. Will report back when I get around to updating and retrying.
     
    Last edited: Mar 6, 2021
  7. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    I haven't had time to resubmit a bug report but was able to reproduce in the latest version of Unity.

    I was able to narrow down the problem a bit more. Bundle A contained just one addressable folder, and the folder contains a bunch of assets. Bundle B is the same.

    If I edit an asset in the folder that contains Bundle A assets, both Bundle A and Bundle B get dirty. (Bug, unexpected) If I mark the asset I want to edit as its own addressable asset explicitly (has its own explicit address and entry in Bundle A) and edit it, Bundle A gets dirty as expected but Bundle B does not. (Expected outcome)

    So the asset is included in Bundle A in either case. In one case it's included because its parent folder is marked addressable (bug can be observed) and in the other it is included explicitly with its own entry (bug no longer observed).

    This is a real project with real assets and such. I can't reproduce it in an empty project with simple scriptable objects and small bundles.
     
  8. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    @TreyK-47 I just spent 2 days peeling back the project and trying to narrow the problem down.

    It seems like the problem is due to Unique Bundle Id's. It seems like any change in Bundle A causes bundle B to be rebuilt too because of this checkbox.

    Feedback: This was extremely hard to debug. It took a very long time. I wish there was some easier way to see why and when a bundle is going to have to be rebuilt instead of re-used. I wish there was some option to turn on more verbose logs.

    Secondly: The documentation here:
    https://docs.unity3d.com/Packages/c...manual/AddressableAssetsDevelopmentCycle.html

    says:

    Seeing as option 2 is unusable and unrealistic for our use case (any minor change to the small parent 'metadata' bundle causes the bundles with the actual assets to be regenerated...), we'd like to go with option one.

    But how exactly do I ensure this..? Say I've initialised addressables and loaded up some data already. I then want to update my catelogue. How exactly do I make sure I've unloaded everything correctly?

    There doesnt seem to be a way to clearly bring Addressables back to a reset/ground state. How do I achieve this so that it is safe to download a new catelogue ?
     
  9. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
    Thanks for the feedback, @Prodigga. I'm going to flag this with the team again, and either myself or a team member will share some further guidance/insight. :)
     
  10. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Sounds great, thanks!

    I ran a test and things do appear to be working with my code. I do try to ensure things are unloaded before I download bundles and it seems to work out.

    My concern stems from the fact that the event window doesn't show an asset being unloaded/released for a little while after you release it. I'm concerned about what'll happen if the game downloads the assets in this window of time, while the old addressables assets are still lingering around.
     
  11. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Just wondering if there is an update
     
  12. andymilsom

    andymilsom

    Unity Technologies

    Joined:
    Mar 2, 2016
    Posts:
    294
    "My concern stems from the fact that the event window doesn't show an asset being unloaded/released for a little while after you release it. I'm concerned about what'll happen if the game downloads the assets in this window of time, while the old addressables assets are still lingering around."

    The right most frame of the event viewer is the current state. If you select an area of the event viewer. You will see a number indicating how many references Asset/Bundles are being referenced by. When the bundle has 0 references (the bar is missing, at the right most frame), then it is unloaded. It will remain in the event viewer as 0 references for a few frames. This can give you a visual representation of loading/unloading over time.
    After updating your catalog and loading your content, if it uses the same bundle, it will reload and increase the reference count. If you have a new bundle, you will see a new entry in the event viewer.

    To give you some info about the issue you we're seeing. Based on the description in this post.
    Unique bundles includes the hash of an Asset into the bundle internal name, so any change to any Asset in a bundle will change its internal name. This internal name is how AssetBundles refer to one another. If you have another bundle that has a dependency on / reference to something in that bundle. Then it will also change, in order to change its reference from the old AssetBundle to the new one.

    In addition to Unique bundle naming.
    In the newer versions that you are using, you will see "Internal Bundle Id Mode" setting. This can help manage this internal name further. "Group Guid" will mean the name doesn't change as assets are added/removed. "Group Guid Project Id Entries Hash" will result in a change of this internal bundle name if the group guid, project id, or entries are changed.

    "But how exactly do I ensure this..? Say I've initialised addressables and loaded up some data already. I then want to update my catelogue. How exactly do I make sure I've unloaded everything correctly?

    There doesnt seem to be a way to clearly bring Addressables back to a reset/ground state. How do I achieve this so that it is safe to download a new catelogue ?"


    We don't have any "release everything" API. You need to manage the handles from all load calls. You could wrap the Addressables.LoadAsset calls and keep track of the handles and release them all in your code. That would be dangerous for any other code that may be trying to use a handle and find that it is not valid and error. So you should be careful there.