Search Unity

Addressables WebGL & loading Remote Scenes

Discussion in 'Addressables' started by Bentoon, Jun 19, 2021.

  1. Bentoon

    Bentoon

    Joined:
    Apr 26, 2013
    Posts:
    98
    Hi all,
    I'm trying to work with addressables specifically, w WebGL builds & loading remote scenes from a server

    Works in Unity addressable play modes
    But Not in Browser
    I just get the first empty scene the next never loads


    I have read that you need to Download first and then LoadScenes
    something like (Pseudo code)

    Code (CSharp):
    1.     [SerializeField] AssetReference assetReferenceScene;
    2.  
    3.  
    4.     void OnSomething()
    5.     {
    6.         //initialize:
    7.         Addressables.LoadAssetAsync<Scene>(assetReferenceScene);
    8.         // Intantiate:      assetReferenceScene.LoadSceneAsync(UnityEngine.SceneManagement.LoadSceneMode.Additive);
    9.  
    10.     }


    I believe my Workflow is solid :
    Loading Scenes Additively may be the best option for me to assemble a variety of assets & dependencies...

    a) import addressables package and make new group (I call 'scenes') and drag the scenes I want to load inside- Note that alone makes them addressable
    - and because it's a scene I don't know if I also need to include the prefabs/ models / materials & textures... but I do and also give them labels

    b) I set up another profile I point to a server I control the permissions on and right click to set as the active profile
    - & I make sure all my groups point to using the remotes Load and Build
    - & check the √ build remote catalog button in the Addressableasset settings also

    c) in my Starting (almost blank) scene, I have a (working) script to load a remote addressable scene (below)


    Code (CSharp):
    1.     [SerializeField] AssetReference assetReferenceScene;
    2.  
    3.  
    4.     void OnSomething()
    5.     {         assetReferenceScene.LoadSceneAsync(UnityEngine.SceneManagement.LoadSceneMode.Additive);
    6.  
    7.     }
    - I test it in the Play mode (use asset database)
    - Then I use the addressables build to build (new build > default) the remote assets to my "Server Data" folder created outside the Assets folder (n my case this is a webGL build, so it creates a webGL folder to hold my bundles .json and hash)
    - After that builds I upload the (WebGL) folder to the remote server (the same file path as the remote setting I provided (above where WebGL is [build target])) & I change the permissions to be completely open so they can be accessed.
    - I test it again in addressable Play mode (with use existing build) selected as this will pull the assets remotely

    Works in Unity addressable play modes
    But Not in Browser
    I just get the first empty scene the next never loads


    Thanks in advance!
    ~b
     
    ReneB-Creator likes this.
  2. Bentoon

    Bentoon

    Joined:
    Apr 26, 2013
    Posts:
    98
    All my hosting permissions of the file have been set to open,
    So I even tried in a new open Bucket on Google Cloud and I am still unable to load remote content

    Here is the console error:

    Exception encountered in operation Resource<IAssetBundleResource>(remote_scenes_all_7daf21d27e3977a8c1cafcb8f0fd12e4.bundle), status=Failed, result= : RemoteAssetBundleProvider unable to load from url https://storage.googleapis.com/bent...s_all_7daf21d27e3977a8c1cafcb8f0fd12e4.bundle, result='HTTP/1.1 404 Not Found'.
    UnityEngine.AsyncOperation:InvokeCompletionEvent () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/AsyncOperation.cs:21)

    Thanks
    ~be
     
    ReneB-Creator likes this.