unity – Missing references in built bundles

The following is a copy of our post in Unity Forum (https://forum.unity.com/threads/missing-references-in-built-bundles.1103689/)


We have a bundle for our scenes and another one to store our prefabs (actually we have around 10 bundles but let’s keep it simple). In every scene we have unpacked prefab instances. We have no problem in playmode using the AssetDatabase but once we use built addressables some unpacked prefab instances in our scenes are broken. Sprites and / or scripts are missing in a inconsistent way; in some scenes those objects are fine and sometime they are not. This comes along multiple warning messages “The referenced script (Unknown) on this Behaviour is missing! “.
Note that the issue also happens when we fully deploy our player.

Unity version : 20193.3.13
Addressables version : 1.16.1

Bundles references diagram

Solution 1 : We tried to remove addressable prefabs (A,B,C in the diagram) from their bundle since we don’t really have to instantiate them at runtime for now and it worked.
Solution 2 : We also tried to put scenes and prefabs into the same bundle and it worked too.
Solution 3 : Switch to 1.18.2 and 1.15.1 version of addressable package and it didn’t work.
Solution 4 : Finally we tried to use the Duplicate Bundles Dependencies analyzer multiple times in order to have no more issues of this type and it didn’t work.

Questions 1: As far as we understand, when addressable groups are built, Unity computes all dependencies and build them inside the bundle along the orignal assets (in my diagram “Scenes” bundles is packed with D’). What we don’t understand is why having our prefabs in a separated bundle break references link in the scenes. Our guess is that Unity doesn’t know which version of those dependencies to use (the one in the scene bundle or the one in the prefab bundle) and somehow fails to load them properly.
Question 2 : Is splitting our content is a good approach, we did it mostly for visibility but it appears to be more a problem in the long term, what are your guidelines regarding this matter ?
Question 3 : Why Duplicate Bundle Dependency rule has to be processed multiple times to properly fix every issue ? We think that running this rule creates duplication issues itself but we can’t really tell..