Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Resolved Missing references in built bundles

Discussion in 'Addressables' started by Alceste, May 3, 2021.

  1. Alceste

    Alceste

    Joined:
    Nov 18, 2014
    Posts:
    10
    Hello,

    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

    AddressablesMissingReferences.png

    Unity version : 20193.3.13
    Addressables version : 1.16.1

    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..

    Thanks.
     
    Last edited: May 5, 2021
    andreiagmu likes this.
  2. Alceste

    Alceste

    Joined:
    Nov 18, 2014
    Posts:
    10
    Bump.

    Why do I have missing scripts and / or invisible sprites when using bundles ?
     
  3. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,796
    I'll flag with the team for some guidance.
     
    Alceste likes this.
  4. Alceste

    Alceste

    Joined:
    Nov 18, 2014
    Posts:
    10
    Quick update, now, deleting SpriteAtlasses right after building our bundles and just before building our player seems to fix most of the issues. Some sprite are still invisible though and deleting our SpriteAtlasses doesn't seem to be a good long-term solution for our production.
     
  5. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    736
    This definitely sounds like a bug. However, I'm thinking this might be an issue with Scriptable Build Pipeline. Would you mind filing a bug with a repro project? It could be an Addressable issue but I'm thinking something about the Sprite Atlas isn't getting built into the bundles correctly.
     
  6. Alceste

    Alceste

    Joined:
    Nov 18, 2014
    Posts:
    10
    We finally managed to fix the issue. This was due to the SpriteAtlas's setting 'Include In Build' which was set to 'false' and wasn't updating properly when turning back on. Because of this, we excluded this option thinking it didn't change anything. The only solution we came up was to delete 'Library' folder, check 'Include In Build' and build the full project (addressable + player).
    I attached a minimal project with a reproduction process. (Unity 2020.2)
     

    Attached Files:

    Plaximo likes this.
  7. clueduppstephen

    clueduppstephen

    Joined:
    Aug 6, 2019
    Posts:
    12
    We are facing a similar issue, we have themed adressable scenes, each is functionally identical in terms of attached prefabs and behaviours, but only one of the scenes works, and if you use it first then load the other scene then the broken scene also works.

    Scenario 1: Start App, load scene 1, blank screen, hundreds of missing behaviour warnings.
    Scenario 2: Start App, load scene 2, scene works, exit scene 2 and load scene 1, scene 1 now works.

    It's as if the dependant scripts only get loaded for one of the scenes.

    Both scenes are in the same group, both are marked addressable.