Search Unity

Scene couldn't be loaded (AssetBundle has not been loaded) (1.2.2)

Discussion in 'Addressables' started by JL_Tech_BBW, Sep 11, 2019.

  1. JL_Tech_BBW

    JL_Tech_BBW

    Joined:
    Jun 22, 2017
    Posts:
    32
    Hello,

    I am stuck with a scene loading problem.

    I have a special project with just my assets and scenes that are in a custom Unity Package (Package Manager)
    and my main project that load these assets and scenes through the Addressable system.

    One strange thing is that the assets and scenes that are in the Package subfolder in the Unity Project inspector does not have the "Addressable" checkbox. Why ?

    So the loading and instantiation is working fine for the assets (Prefabs) but not working when I try to load an additive scene with the
    Code (CSharp):
    1. Addressables.LoadSceneAsync("SceneName", LoadSceneMode.Additive)
    Before loading anything I use the download dependencies method to preload all my asset bundles.
    And I can see each directory and files for each Addressable Group in the asset bundle cache location directory.
    So they are well downloaded.

    I have this error :
    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.2.2/Runtime/ResourceManager/ResourceProviders/SceneProvider.cs:67)
    3. UnityEngine.ResourceManagement.ResourceProviders.SceneProvider+SceneOp.Execute () (at Library/PackageCache/com.unity.addressables@1.2.2/Runtime/ResourceManager/ResourceProviders/SceneProvider.cs:60)
    4. UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].InvokeExecute () (at Library/PackageCache/com.unity.addressables@1.2.2/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:394)
    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.2.2/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:388)
    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.2.2/Runtime/ResourceManager/ResourceManager.cs:390)
    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.2.2/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.2.2/Runtime/ResourceManager/ResourceManager.cs:685)
    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.2.2/Runtime/AddressablesImpl.cs:777)
    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.2.2/Runtime/AddressablesImpl.cs:772)
    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.2.2/Runtime/Addressables.cs:765)
    12. BrandSpace.Modules.GameSession.GameSessionManager.InstantiateObject (BigBadWolf.BrandSpace.DataManagement.Models.DataModel_Asset asset) (at Assets/BBW_Project/Modules/GameSessionSystem/Scripts/GameSessionManager.cs:125)
    13. BrandSpace.UI.Controllers.Controller_UpdateServerSession+<EnterState>d__0.MoveNext () (at Assets/BBW_Project/GUI/Scripts/Windows64/Controller/02_GameSession/Controller_UpdateServerSession.cs:29)
    14. BBW.CorePlugin.FiniteStateMachine.MoveNonNull (System.Collections.Generic.Stack`1[T] actionStack) (at <bca90c249fb84a50a7c84c390e1d04ea>:0)
    15. BBW.CorePlugin.FiniteStateMachine.Update () (at <bca90c249fb84a50a7c84c390e1d04ea>:0)
    Edit : The value returned by the InternalLoad method in the SceneProvider.cs file is null.
     
    Last edited: Sep 11, 2019
  2. JL_Tech_BBW

    JL_Tech_BBW

    Joined:
    Jun 22, 2017
    Posts:
    32
    I found that if the scene is not in a package but in the main "Assets" hierarchy, it is working fine.
    So this is definitively a problem with the UPM.
     
    unity_bill and pahe4retro like this.
  3. RecursiveFrog

    RecursiveFrog

    Joined:
    Mar 7, 2011
    Posts:
    170
    Oof! That sounds bad. Is this a regression or has it always been this way?

    My project has UPM assets that are marked addressable but none of them are scenes... just prefabs, shaders, and the like.

    Are you able to make non-scene objects in your unity package addressable, @JL_Tech_BBW ?
     
  4. JL_Tech_BBW

    JL_Tech_BBW

    Joined:
    Jun 22, 2017
    Posts:
    32
    It is working fine with my prefabs that are in the package.
    So it is maybe just a problem with scenes. (But maybe with other kinds of objects.)