Confused About 'RevertUnchangedAssetsToPreviousAssetState' and static content update

Hi,
I tried to update content with the ‘update a previous build’ workflow, there are 2 issues pops up. Tested on both 1.18.16 and 1.19.6, the results are same.
The issues are related with static content.

  • Even 1 prefab is slightly changed, like change the scale, change the color of Image component, the size of catalog.json grows from ~3MB to ~60MB.
  • after loading updated catalog.json, there is exception says Invalid path in AssetBundleProvider '' from AssetBundleResource.BeginOperation()

The issues are caused by RevertUnchangedAssetsToPreviousAssetState.ApplyAssetEntryUpdates()
Take my case for example:

  • one of UIs in game, say Prefab1, who references many Sprites, is included in AssetBundle A
  • the referenced Sprites, Sprite1,2,…10, are included in AssetBundle B
  • build content and player, get catalog.json1
  • modify Prefab1, and build content with ‘update a previous build’, get catalog.json2

The issues:

  1. catalog.json2 is much more larger than catalog.json1. By deserializing and comparing them, the key list of AssetBundle B is much longer.
    in catalog.json1, AssetBundle B has only 1 or 2 keys, which is easy to understand, its InternalId is file path, its key is its lowercase group name:

InternalId: {UnityEngine.AddressableAssets.Addressables.RuntimePath}/AssetBundleB_all_assets_hash.bundle
Keys: assetbundleb

And in catalog.json2, the key list could be very long, there are extra keys like AssetBundle B’s InternalId + some asset’s hashcode:

Keys:
{UnityEngine.AddressableAssets.Addressables.RuntimePath}/AssetBundleB_all_assets_hash.bundle-15210046
{UnityEngine.AddressableAssets.Addressables.RuntimePath}/AssetBundleB_all_assets_hash.bundle7521648523

the actual situation would be more complicated, in the above 60MB catalog.json I mentioned, many asset bundle entries have 10000+ keys after updated.

  1. right after the client downloaded the catalog.json2, errors pop up immediately when it tries to load something. The error is Invalid path in AssetBundleProvider'' from AssetBundleResource.BeginOperation() ln 430. The reason of this error is because it is trying to load a scene, the scene’s asset bundle has several dependencies, which are also asset bundles, but these AB’s field “Data” is empty, which is supposed to be AssetBundleRequestOptions. It cause the loadType returns None in AssetBundleProvider.GetLoadInfo().

What it looks like is:
at the end of “update a previous build”, the build script runs RevertUnchangedAssetsToPreviousAssetState.ApplyAssetEntryUpdates(), it dose something like this:
It detects Prefab1 has dependency assets Sprite1…100, for each sprite, it find the asset bundle which contains the sprite, then add a location, whose internal id is the assetbundle file name, and the key is assetbundle’s file name + Prefab1’s hash code.
In this case, all sprites are packed in asset bundle B, so asset bundle B has 100 new locations.
In RevertUnchangedAssetsToPreviousAssetState.cs ln 187, you can see these locations have no Data, which means they have no AssetBundleRequestOptions. In most time these locations will be merged into the “real” asset bundle entries in ContentCatalogData.SetData(). But in my case, one of these locations becomes the “real” entry of asset bundle B, so operation chains finally fail due to the above runtime error when “load scene”->“load scene’s asset bundle”->“load dependencies”->“load asset bundle B”(it’s loadType is None)

So what confused me is:

  1. what RevertUnchangedAssetsToPreviousAssetState.ApplyAssetEntryUpdates() does? why add so many weird locations?
    there is comment says “If the entry has dependencies, we need to update those to point to their respective cached versions as well.”, but I don’t quite understand what it means.
  2. It’s 100% reproducible at my side here. If it’s a bug, many users would met the same error, however actually they don’t. Is there any settings/steps I did wrong during the whole workflow? How to fix it?

Did some test, when run clean build, all asset bundles have no dependencies. When run “Update a previous build”, asset bundles have dependencies, is it expected result?
For example:

  • Prefab1 references Prefab2, Prefab2 references Prefab3
  • Prefab1 is in AssetBundle A, Prefab2 is in AssetBundle B, Prefab3 is in AssetBundle C
  • Run clean build, Prefab1 has 3 dependencies: AssetBundle A,B,C. Asset Bundles have no dependencies.
  • When run “Update a previous build”, now AssetBundle A has 2 dependencies: AssetBundle B and C.

The problem is, for some reason if AssetBundle C has dependency A, when loading Prefab1 in game:

  • Create “Load Prefab1 operation”
  • add its dependency operation “Load AssetBundle A”
  • add its dependency operations “Load AssetBundle B” and “Load AssetBundle C”
  • add dependency operation of “Load AssetBundle C”, which is “Load AssetBundle A”, which reuse the cached operation created in step 2

Then “Load AssetBundle A” is waiting for “Load AssetBundle C” to complete before start loading asset bundle A, “Load AssetBundle C” is waiting for “Load AssetBundle A” to complete.
It’s locked, “Load Prefab1” will never be completed.

Have you found any way to solve this problem? We got this issue too.I saw that in the Changelog of version 1.19.17


So i try to use this version,but it doesnt worked correctly:face_with_spiral_eyes: its still report the error “Invalid path in AssetBundleProvider: '” and there is still some keys in the updated catalog.json like AssetBundle B’s InternalId + some asset’s hashcode

I belive it’s a bug, so I added some codes at the ends of BuildScriptPackedMode.DoBuild(), to remove asset bundles’ dependencies from the catalog file. I think asset bundle’s dependencies are collapsed into asset’s dependencies, so asset bundle’s dependency info are not necessary