Addressables directories and checking content update restrictions do not get along

Very simple case:


All groups local and static (Cannot Change Post Release).
The GameObject.prefab has direct references to SquareDir.png and Triangle.png. So one reference of each group. The only difference between these two references is that one is located inside an addressable directory and the other is not.
Now we build, and not surprisingly, an addressables_content_state.bin file is created.
Then how about we modify a value in GameObject.prefab? like the x coordinate of its transform component.
Finally, let’s run the Check Content Update Restriction tool. Since dependencies are considered, the new content update group should contain: GameObject.prefab, SquareDir.png and Triangle.png.
Oddly enough, this is the result:

The asset (SquareDir.png) inside the addressable directory is not detected!..
This causes runtime errors when this content update bundle is downloaded and applied, because the prefab won’t have the reference to that asset.
This seems to me a very common scenario of usage. Perhaps no one uses addressables directories?

Anyway, after investigating why that asset wasn’t showing up in the content update preview window, I found out that the method GetStaticContentDependenciesForEntries of ContentUpdateScript.cs calls this
var depEntry = settings.FindAssetEntry(guid); FindAssetEntry then calls
var e = g.GetAssetEntry(guid);.
But GetAssetEntry method only considers the assets marked as an addressable explicitly. So it returns null here. Although the dependencies are calculated correctly, this is completely skipped because of this.

2 Likes

I’ll flag this for the team to have a look. Which version of Addressables are you using?

We are using Addressables 1.16.1. But I’ve tested some other 1.16.x versions and the same thing still happens. (I also tested 1.17.x but there are others issues [that I’ve already reported] before this one so I couldn’t test it)

Hi we’ve changed the behavior of “Check for Content Update Restrictions” in 1.17.13 to only list dependencies for modified assets if the bundle name has changed. For example this can be trigged by changing the value of Internal Bundle Id Mode from “Group Guid Project Id Entries Hash” to something else, prior to a content update.

I’m still creating a ticket for this because testing the example in the latest version is still buggy (is causing an ArgumentNullException). Out of curiosity, is this similar to the other bugs you’ve already submitted? This way we can close out any duplicate bugs if that’s the case.

Ok that’s good to know. Will that only impact the visual side of things? (i.e. dependencies won’t be listed but internally they will be included)
Also, what was the rationale behind that change? (Only listing dependencies for modified assets if the bundle name has changed)

I mean in reality, in the latest versions (1.17.x) I only encountered that exact bug you mentioned (ArgumentNullException) from which I submitted a bug report through the Unity editor.
Although, I ended up not submitting a bug report for the issue I described in this thread. (Since the ArgumentNullException was in my way)

It’s not just a visual change, the dependencies won’t be included at all internally (if the bundle name hasn’t changed). This is because of the new options we added for Internal Bundle Id Mode.

Previously we would always include the hash of all the entries a group in the bundle name (currently the same behavior occurs when the Internal Bundle Id Mode is set to “Group Guid Project Id Entries Hash”). If an asset is modified, the hash will change and so will its bundle name. Because an asset’s dependencies reference the old bundle name internally, they need to be included in the content update.

If the bundle name is unchanged, then there is no reason to include the dependencies in the update as their references will still be valid.

Good to know! I saw that your ArgumentNullException bug report is already being looked at, so it should be fixed soon :slight_smile:

1 Like

I have reference missing problem in situation below

  • Addressable version 1.16.10

  • Windows Platform

  • Default Local Group:Update Restriction = Cannot Change Post Release;Bundle Mode = Pack Separately; Bundle Name = File Name

  • Drag a folder which has a prefab and a textureprefab’s reference)into group

  • 7243436--872366--upload_2021-6-16_17-20-35.png

  • Use Addressables.InstantiateAsync(“Assets/Prefabs/Prefab.prefab”, transform) in a monobehavior in the main scene

  • Build Bundle

  • Build exe

  • Change the Prefab

  • Check For Content Update Restriction:only prefab move to ”Content Update“ Group, I check the addressable source code, in the GetStaticContentDependenciesForEntries function, only dependency which is an entry can be added to dependencyMap.So is that means every asset(not folder) should be an entry?

  • 7243436--872381--upload_2021-6-16_17-48-2.png

  • Update a Previous Build

  • Execute the exe

  • The origin prefab is like

  • 7243436--872387--upload_2021-6-16_17-55-39.png

  • And i changed the color of image component,then after the update build, the prefab becomes

  • 7243436--872390--upload_2021-6-16_17-59-46.png

  • what expect is

  • 7243436--872393--upload_2021-6-16_18-2-3.png

And i use WebExtract & Binary2text Tool to check the bundles in StreamingAssets and ServerData folder ,and find that the ContentUpdate Group Bundle’s External Reference is the new bundle in the library, not the bundle in the StreamingAssets.
I guess every time addressable build bundles, it build all bundles including “can not change” bundles, and calculate bundle dependencies. Is it possible to let “content update” bundle reference to the bundle in StreamingAssets built before ?
Also i tried addressable 1.18.9, if i set the Internal Bundle Id Mode “Group Guid”, the problem gone, because the id won’t change. But “Group Guid Project Id Entries Hash” selection still has the problem.

@rookiemike Thanks for the detailed instructions! I was able to reproduce the issue, and will create a ticket to work on the fix :slight_smile:

I don’t think there is a way to make the “content update bundle” reference the old bundle. The expected behavior for “Update a Previous Build” is detailed here: Content update builds | Addressables | 1.18.19

What was the ticket that was created for this issue?
We have a work around in place for this which is to recursively expand our addressables folder mappings at build time to remap them as individual assets, but this is not ideal.

What is the recommentation, should we not be using addressables folder mappings if we want to use content updates?

Unity 2019.4.33
Addressables 1.19.13
Android/iOS

It is strange, I think that png shouldn’t be moved content group, It doesn’t change at all. Addressables should get it from Default Local Group