Recently, I upgraded Addressables from 1.19.19 to 1.20.3, and found building aab/ipa became slow. Before, building aab took about 20 minutes. After upgrading, it took 4.5 hours!
After some investigation, I found it’s due to building cache for FindAssetEntry repeatedly, which was added in Addressables 1.20.0.
Each time we build the aab(or ipa), we remove all entries from a group which contains shared assets between bundles, and execute our custom CheckBundleDupeDependencies rule to put all current shared assets into this group. During this phase, RemoveAssetEntry is called multiple times, and the cache for FindAssetEntry is rebuilt repeatedly.
Besides that, we have some tools that modify Addressable settings, which can also be affected by this issue, for exmaple:
- We use this tool(GitHub - favoyang/unity-addressable-importer: A rule based addressable asset importer) to set asset addressable automatically. When we update other people’s changes, there may be a large number of assets need to be processed.
- We have some special versions which only have a part of assets in the aab/ipa. Other assets will be downloaded by Addressables.DownloadDependenciesAsync at the runtime. So, before building these versions, we execute a tool to set labels for these assets.
For our project, this cache is not so helpful, since there is only about 30 Addressable groups in the project (Although, the group containing shared assets is very large). Currently, I just disable the cache for FindAssetEntry to avoid this issue.
Hope it can be imporved in the future version.