Search Unity

Addressables cannot find some Scenes (but not others) in Windows published exe

Discussion in 'Addressables' started by RecursiveFrog, Aug 18, 2019.

  1. RecursiveFrog

    RecursiveFrog

    Joined:
    Mar 7, 2011
    Posts:
    350
    So I am suddenly out of nowhere seeing this issue when creating an EXE build of a game that relies on addressables for its scene loading. It also happens in Packed Play Mode.

    This does not happen in Fast Play mode, or Virtual Play Mode, and the game works as expected.

    In my project, I have exactly one scene in the Build settings, which is the main entry point to the application. Every other scene is supplied by addressables. I now am seeing some scenes that, when I try to load them with Addressables, fail with that error. I don't know when or why this occurs.

    To fix this, I tried
    Addressables->Clean->All
    Addressables->Build Player Content

    The error persists. So, I decided to see if the asset bundles actually exist. I opened the export folder :
    build\Windows\MYGAME_Data\StreamingAssets\aa\Windows

    And I saw asset bundles that were named after the scenes that could not be loaded... so the bundles do exist. In fact, data for scenes that can AND cannot be found all exist.

    defaultlocalgroup_scenes_SCENETHATWORKS_61748a1c411183f2842a6afbf18859ab
    defaultlocalgroup_scenes_ANOTHERSCENETHATWORKS_f5117a756b77a9b1bb84b1b37e2cbe51
    ...
    defaultlocalgroup_scenes_SCENETHATISNOTFOUND_83f1a89f890a718f964504d395a672fc
    defaultlocalgroup_scenes_ANOTHERSCENETHATISNOTFOUND_7f6144f3491eb8792d9b367a2c8cd9da

    I'm a bit at my wits end with this. Is there some place that some old stale data is hiding that I should just delete from the file system? Is this an instance where I might have to try to re-build the entire addressable asset structure asset by asset?
     
  2. RecursiveFrog

    RecursiveFrog

    Joined:
    Mar 7, 2011
    Posts:
    350
    I made some progress, but I don’t understand why this seems to have worked.

    I have a GameManager prefab that exists as a singleton. It is embedded in my single Startup scene. I also embed it in some other scenes, so that I can test them in isolation, knowing that it’s Singleton nature will simply cause the second GameManager to be Destroyed on Awake.

    This did not seem to cause a problem before, but it does now. I noticed that every scene that failed to load had one of those GameManagers in it. So I deleted them and those scenes work now.




    BUT


    All this was in a “development build”. When I uncheck development build, a totally different scene fails to load, that used to previously work.
     
  3. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Hmm, this is odd. There was a scene dependency unloading issue that we've fixed in the release coming out this week (1.1.8 or so). Please try with that release, and let us know what does or does not work at this point.
     
  4. RecursiveFrog

    RecursiveFrog

    Joined:
    Mar 7, 2011
    Posts:
    350
    Thanks @unity_bill , I’ll kee my eye open for the update.

    At this point now it’s not even consistent between builds which scenes fail to be loaded, except that the only scenes ive never seen fail are things like:

    Startup scene
    Splash scenes
    Title scene
    Save/load scene

    But everything else might or might not fail... so it’s very hard to even track down the possible source
     
  5. RecursiveFrog

    RecursiveFrog

    Joined:
    Mar 7, 2011
    Posts:
    350
    @unity_bill I have installed Addressables 1.1.9 and it doesn't resolve this problem. Some scenes still may simply not be loaded for no reason I can discern.

    Is there anything I can send to your team to help identify and diagnose this issue? A catalogue? A manifest? An asset bundle path? An asset bundle collection?
     
  6. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Realistically the best option for us to track it down would be to file a bug report against unity and provide the project.

    Though I do have one other idea/theory. There's an issue in the engine that's fixed in 2019.3.0a12. The issue has to do with script dependencies not getting built correctly. If you can upgrade your project, please try that. The fix should be backported to 2019.2 and 2018.4 but isn't there yet.

    There are lots of issues this was causing, and several forum threads about it, but the most recent (and the one that mentions backport targets) is here: https://forum.unity.com/threads/case-1174117-addressable-dependency-resolution-is-unreliable.721658
     
  7. RecursiveFrog

    RecursiveFrog

    Joined:
    Mar 7, 2011
    Posts:
    350
    @unity_bill Unfortunately when I tried to switch to 2019.3.0f12, it broke Rewired (as in, gave build errors such that I can't compile the game), and Rewired only officially supports LTS releases. So unless there's a plan to backport that into 2018.4 I won't be able to even test the solution.

    I may try one more thing, which is to put all the contents of these scenes into a prefab, and then load the prefabs as addressables into a single host scene.

    As for sending the project... I don't know man, do you typically deal with 40GB projects and dependencies on custom UPM packages?
     
  8. RecursiveFrog

    RecursiveFrog

    Joined:
    Mar 7, 2011
    Posts:
    350
    An update: I think this is related to scenes and prefabs that are addressable, that themselves contain addressables.

    I have reconfigured my project such that I've placed all the contents of problem scenes into root-level GameObjects. Those root level game objects are now the "scenes" being loaded, instead of actual Unity scenes. This *seemed* to resolve one of the problem scenes but not the final one.

    The final scene was "solved" after I removed all the internally nested prefabs from it. I do not know if one particular prefab was the culprit, or if all of them combined were. However, one of the prefabs was itself an instance of an Addressable object. I needed the entire object heirarchy from that asset, so I simply "Unpacked Completely" the prefab instance, so it was no longer addressable. Unfortunately it's also no longer a prefab :p
     
  9. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    That sounds like the engine dependency bug. By having a prefab in a scene, and addressable, the scripts can end up in two places, and the engine wasn't sure how to deal with that.

    This fix will be backported to 2018LTS, but I'm not sure when.
     
  10. JL_Tech_BBW

    JL_Tech_BBW

    Joined:
    Jun 22, 2017
    Posts:
    32
    Hello,
    I have the same error with v1.1.10.

    FYI, I load an external catalog with "LoadContentCatalogAsync".
    Then I use "LoadSceneAsync"

    I have one more error message :

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEngine.ResourceManagement.ResourceProviders.SceneProvider+SceneOp.InternalLoadScene (UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation location, System.Boolean loadingFromBundle, UnityEngine.SceneManagement.LoadSceneMode loadMode, System.Boolean activateOnLoad, System.Int32 priority) (at Library/PackageCache/com.unity.addressables@1.1.10/Runtime/ResourceManager/ResourceProviders/SceneProvider.cs:67)
    3. UnityEngine.ResourceManagement.ResourceProviders.SceneProvider+SceneOp.Execute () (at Library/PackageCache/com.unity.addressables@1.1.10/Runtime/ResourceManager/ResourceProviders/SceneProvider.cs:60)
    4. UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].InvokeExecute () (at Library/PackageCache/com.unity.addressables@1.1.10/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:391)
    5. UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].Start (UnityEngine.ResourceManagement.ResourceManager rm, UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle dependency, DelegateList`1[T] updateCallbacks) (at Library/PackageCache/com.unity.addressables@1.1.10/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:385)
    6. UnityEngine.ResourceManagement.ResourceManager.StartOperation[TObject] (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject] operation, UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle dependency) (at Library/PackageCache/com.unity.addressables@1.1.10/Runtime/ResourceManager/ResourceManager.cs:301)
    7. UnityEngine.ResourceManagement.ResourceProviders.SceneProvider.ProvideScene (UnityEngine.ResourceManagement.ResourceManager resourceManager, UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation location, UnityEngine.SceneManagement.LoadSceneMode loadMode, System.Boolean activateOnLoad, System.Int32 priority) (at Library/PackageCache/com.unity.addressables@1.1.10/Runtime/ResourceManager/ResourceProviders/SceneProvider.cs:164)
    8. UnityEngine.ResourceManagement.ResourceManager.ProvideScene (UnityEngine.ResourceManagement.ResourceProviders.ISceneProvider sceneProvider, UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation location, UnityEngine.SceneManagement.LoadSceneMode loadMode, System.Boolean activateOnLoad, System.Int32 priority) (at Library/PackageCache/com.unity.addressables@1.1.10/Runtime/ResourceManager/ResourceManager.cs:596)
    9. UnityEngine.AddressableAssets.AddressablesImpl.LoadSceneAsync (UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation location, UnityEngine.SceneManagement.LoadSceneMode loadMode, System.Boolean activateOnLoad, System.Int32 priority) (at Library/PackageCache/com.unity.addressables@1.1.10/Runtime/AddressablesImpl.cs:721)
    10. UnityEngine.AddressableAssets.AddressablesImpl.LoadSceneAsync (System.Object key, UnityEngine.SceneManagement.LoadSceneMode loadMode, System.Boolean activateOnLoad, System.Int32 priority) (at Library/PackageCache/com.unity.addressables@1.1.10/Runtime/AddressablesImpl.cs:716)
    11. UnityEngine.AddressableAssets.Addressables.LoadSceneAsync (System.Object key, UnityEngine.SceneManagement.LoadSceneMode loadMode, System.Boolean activateOnLoad, System.Int32 priority) (at Library/PackageCache/com.unity.addressables@1.1.10/Runtime/Addressables.cs:750)
     
  11. RecursiveFrog

    RecursiveFrog

    Joined:
    Mar 7, 2011
    Posts:
    350
    I think that is not the same issue. I don’t receive that exception, and I don’t use external catalogues.

    If I had to guess, your exception happens at an earlier point in the process, and it’s because of the external catalogue. You hit a nullreferenceexception at InternaLoadScene whereas my stacktrace makes it several steps further and tries (unsuccessfully) to load the scene.
     
  12. RecursiveFrog

    RecursiveFrog

    Joined:
    Mar 7, 2011
    Posts:
    350
    At the risk of prematurely celebrating, I think that Addressables 1.2.2 / Unity 2018.4.8f1 has resolved this issue @unity_bill

    I tested by returning to using only Scenes, and abandoning the special case hodgepodge of scenes and prefabs. I successfully built a running standalone application that no longer fails to find the scenes that were built.

    It may be possible that some other configuration of nested assets might cause the issue to reoccur, but for the time being this appears to be working as expected.