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

Bug ScriptableObject References in Addressable Scene is lost (starting from 1.18.x)

Discussion in 'Addressables' started by Xtro, Aug 24, 2021.

  1. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    557
    Bug report: https://fogbugz.unity3d.com/default.asp?1360522_76mcdeo6j706ulub
    Issue tracker: Pending

    1. Open the project and open Startup scene.
    2. Open "Addressables Groups" window and build the bundles via Build>New Build>Default Build Script option.
    3. Switch to "Use Existing Build" option in Play Mode Script menu to make sure built bundles are used in play mode.
    4. Play the Startup scene and seethat the Startup script loads AddressablesScriptableObjectTest scene from the bundle.
    5. Select "AddressablesScriptableObjectTest" object in AddressablesScriptableObjectTest scene.
    6. See that SO_Reference is null but Prefab reference is good.
    7. Stop play mode and open AddressablesScriptableObjectTest scene in edit mode.
    8. Select "AddressablesScriptableObjectTest" object in AddressablesScriptableObjectTest scene.
    9. See that SO_Reference has a valid reference value.
    This problem started to happen in Addressables 1.18.x versions.
     

    Attached Files:

    Se7eNHea7eN likes this.
  2. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    557
  3. manuelgoellnitz

    manuelgoellnitz

    Joined:
    Feb 15, 2017
    Posts:
    366
    I have the same problem, but not after updating the addressables version (we are still on 1.16.15) but when we updated from Unity 2021.1.7 to 2021.2.0b8.

    The difference is, that in our project the bug does not appear in the editor at all, but only in a build. It seams to me that
    a) unity does not include the scriptable Objects in the build or
    b) deletes them when the scene is opened or
    c) does not include them in the scene-addressable

    Because the reference is not lost, when I make the scriptableObject-Assets addressables and add them to a addressables-group.

    The reference is also not lost, when the scriptableObjects are referenced in more then one scene and the Analyze-Tool is used to isolate the duplicates into new adressables.
     
  4. manuelgoellnitz

    manuelgoellnitz

    Joined:
    Feb 15, 2017
    Posts:
    366
    Same behavior with Adressables 1.18.15
     
    Moritz5thPlanet likes this.
  5. Thermos

    Thermos

    Joined:
    Feb 23, 2015
    Posts:
    148
    Disable non-recursive dependency calculation or enable monoScript prefix ,then do a clean rebuild should fix the problem. I have submit a bug report a week ago but not receiving any response from Unity QA.
     
    therobby3 likes this.
  6. shu0214

    shu0214

    Joined:
    Sep 17, 2019
    Posts:
    2
    Same here, and I've tried to disable "Non-Recursive Dependency Calculation", or downgrade to Unity 2021.1.16f1 to use Addressable 1.17.17, and Scripting Pipeline Build 1.17, then confirmed the problem doesn't occur. Thanks.
     
  7. manuelgoellnitz

    manuelgoellnitz

    Joined:
    Feb 15, 2017
    Posts:
    366
    Same here "Non-Recursive Dependency Calculation" helped. But when I enable "monoScript prefix", The addressables wont build (I get a lot of errors).
     
  8. Alesk

    Alesk

    Joined:
    Jul 15, 2010
    Posts:
    339
    Hi,

    Unity 2021.3.0f1, Addressables 1.20.3

    This bug is still present :(

    I tried to disable "Non-Recursive Dependency Calculation", but it didn't helped... The Scriptable Objects are still missing !
     
    Last edited: Jul 14, 2022
  9. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    557
    After they said they fixed it (see the fogbugz link in my first post), we didn't experience this problem again.

    We are on Unity 2021.2.18 and Addressables 1.19.19.

    I wonder if they resurrected this problem back in Addressables 1.20.3.
     
  10. Alesk

    Alesk

    Joined:
    Jul 15, 2010
    Posts:
    339
    I was first using Addressables 1.19.19, and the problem was here too... I then upgraded to 1.20.3 with some hope, but nothing changed :/

    Maybe I'm doing something else wrong. Are you doing something special to deal with your scriptable objects in this case ?
     
  11. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    557
    No. Nothing special.

    We just have references from the scene objects (scripts) to scriptable objects in the project and they work fine when we build our scenes into bundles via Addressable Groups.
     
  12. Alesk

    Alesk

    Joined:
    Jul 15, 2010
    Posts:
    339
    Could it be possible for you to send me a very basic working sample project, to let me compare with mine, and see what I'm missing please ?
     
  13. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    557
    I am very sorry but I can't do that right now because of 2 reasons. First, our project is big and has some customized addressables features. Second, I am currently dealing with a very ugly WebGL bug in our project. :( So sorry.
     
  14. Alesk

    Alesk

    Joined:
    Jul 15, 2010
    Posts:
    339
    No problem ! I understand very well ;)
    I've done some more tests and it seems that something might be broken in my project (which was first developped on unity 2020). I tried to start a new fresh one on unity 2021, and the bug seems not occuring anymore.
    So I'll try to rebuild everything from that.

    Good luck with your bug hunt !
     
  15. Treaston

    Treaston

    Joined:
    Apr 22, 2021
    Posts:
    1
    Sooo: Disableling "Non-recursive Dependency Calculation" helped for me. Just trying to curb some of the survivorship bias that might occur.
     
  16. Alan-Liu

    Alan-Liu

    Joined:
    Jan 23, 2014
    Posts:
    349
    Hi, Thermos
    Have the bug you reported been fixed?
     
  17. Thermos

    Thermos

    Joined:
    Feb 23, 2015
    Posts:
    148
    I remember it's fixed.
    I published my game with Addressable 1.19, and shipped some updates already without any problem. It's a stable version.
     
    Alan-Liu likes this.
  18. airoll

    airoll

    Joined:
    Jan 12, 2021
    Posts:
    37
    I'm also running into this issue, I'm on Unity 2021.3.8 LTS and have tried Addressables 1.19 and 1.20 and have tried disabling Non-Recursive Dependency Calculation but I am still getting null references to objects when loading the scene.
     
    DavidZobrist likes this.
  19. Cameo221

    Cameo221

    Joined:
    Aug 2, 2018
    Posts:
    35
    I had an issue with this as well. But I changed the "MonoScript Bundle Naming Prefix" from "disabled" to "project name hash" and that immediately solved my issue. :)

    Edit: It only solved the issue in the editor. In builds, it's the same problem.
     
    Last edited: Nov 23, 2022
  20. Ardito92ITA

    Ardito92ITA

    Joined:
    Apr 1, 2014
    Posts:
    37
    Bug still exists in Unity version 2022.2.0f1
     
  21. Alan-Liu

    Alan-Liu

    Joined:
    Jan 23, 2014
    Posts:
    349
    Hi, do you have a reproducible project of the bug?
     
  22. therobby3

    therobby3

    Joined:
    Jan 30, 2019
    Posts:
    130
    Also was having this issue with assets. Un-ticking the "Non Recursive Dependency" box seemed to fix it.
     
  23. AdamBebkoSL

    AdamBebkoSL

    Joined:
    Dec 9, 2021
    Posts:
    33
    Many thanks Unchecking "Non Recursive Dependency" In AddressableAssetSettings did the trick for me too!! Hopefully unity fixes this. Unity 2022.3.5f1, Addressables pkg version 1.19.19
     
    Last edited: Dec 23, 2022
  24. AdamBebkoSL

    AdamBebkoSL

    Joined:
    Dec 9, 2021
    Posts:
    33
    Just to update a bit further, I needed "Non Recursive Dependency" for other reasons. I managed to fix the issue upgrading both packages below:
    1. Scriptable build pipeline to 1.21.1
    2. Addressables to 1.21.2
    All issues miraculously disappeared.