Search Unity

Addressable Scenes Not Loading Dependencies

Discussion in 'Addressables' started by cyangamer, Apr 21, 2021.

  1. cyangamer

    cyangamer

    Joined:
    Feb 17, 2010
    Posts:
    216
    I'm having trouble getting addressables working for my use case. I need two scenes to be downloaded from a CDN so that they can be loaded at a later time for my Android game. To just get a proof of concept going, I implemented the feature to just download the scene when the user clicks a button (instead of preloading at game start).

    I've followed a tutorial (though it was a bit outdated) to get this set up, and here is the code for loading the scene.

    Code (CSharp):
    1.  
    2. // LOAD THE SCENE FILE FROM ADDRESSABLE
    3.             AssetRefObjectData assetRefData = GameObject.Find("AssetHolder").GetComponent<AssetRefObjectData>();
    4.             AssetReference assetRef = sceneName.EndsWith("6") ? assetRefData.GetStage6() : assetRefData.GetStage7();
    5.             AsyncOperationHandle<SceneInstance> operation3 = assetRef.LoadSceneAsync(LoadSceneMode.Additive);
    6.             Debug.Log("Load stage scene");
    7.             progressBarAnim.SetTrigger("FirstHalfCompleted");
    8.  
    9.             while (operation3.Status != AsyncOperationStatus.Succeeded)
    10.             {
    11.                 float progress3 = Mathf.Clamp01(operation3.PercentComplete / 0.9f);
    12.                 progressBar.value = 0.33f + (progress3 / 3);
    13.                 yield return null;
    14.             }
    15.  
    I set up my addressables like so:
    upload_2021-4-20_20-30-28.png

    I've set Play Mode Script to Use Asset Database (not exactly sure what this does as this isn't documented, to my knowledge). Clicked Build -> New Build -> Default Build Script.

    When I run the game and click to load Stage6, it loads but all the textures and shaders are gone. Magenta everywhere!

    Is there something else I need to do in order to get the dependencies to load?
     
    Last edited: Apr 21, 2021
unityunity