building with addressables

I have a simple test project
2 scenes, both addressables
the loading scene has a script which does the … scene loading
scene loader

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.ResourceManagement.ResourceProviders;
using UnityEngine.SceneManagement;

public class SceneLoader : MonoBehaviour
{
    [SerializeField] UnityEngine.AddressableAssets.AssetReference sceneToLoad;
    public float loadProgress;

    // UI hooks button to launch the scene loading
    public void OnClickButtonLoad()
    {
        StartCoroutine(_OnClickButton());
    }
   
    IEnumerator _OnClickButton()
    {
        var loadDependenciesAsync = UnityEngine.AddressableAssets.Addressables.DownloadDependenciesAsync(sceneToLoad);
        yield return loadDependenciesAsync;
        var loadAsync = sceneToLoad.LoadSceneAsync(LoadSceneMode.Additive);
        loadAsync.Completed += LoadComplete;
        // update loadProgress for the UI
        while (!loadAsync.IsDone)
        {
            loadProgress = loadAsync.PercentComplete;
            yield return null;
        }
    }
   
     void LoadComplete(AsyncOperationHandle<SceneInstance> _scn)
    {
        if (_scn.Status == AsyncOperationStatus.Succeeded)
        {
            Debug.Log("Downloaded " + _scn.Result.Scene.name);
        }
        else
            Debug.Log("Error: " + _scn.OperationException.Message);
    }
}

this loads the scene in the editor but it doesn’t load the scene in the build
the tutorial.addressables:scene loading doesn’t show an extra step required (tuto bug)
what’s the extra step?

Let me flag this for the team to have a look. In case we miss it on one of your other threads, could you also comment here which version of Addressables you’re using? :slight_smile:

1 Like

Thanks for the answer,
the version used is 1.10
I have switched it to this play mode
6004157--646679--upload_2020-6-20_13-6-28.png
now i’m getting this


I don’t know where “packed data build” is, it must be a asset bundle terminology that is absent from the addressable GUI = that’s one bug
So I run the closest thing
6004157--646685--upload_2020-6-20_13-7-58.png
it says this in the console
6004157--646688--upload_2020-6-20_13-9-34.png
and no progress bar happens despite this

still getting the red error when i press play
it works fine in another project so I think the issue is settings but there are so many settings in addressable that I don’t know where to look (another bug)
so I’ll log a bug with this project attached … #1257466

So under your Build menu I’m only seeing Update Previous Build and Clean Build. There should be an option called New Build → Default Build Script that will allow you to build that player content. Have you modified any of the build scripts or removed any by chance? If not would you mind closing the editor, deleting your PackageCache folder and the com.unity.addressables folder in your Library folder and then restarting the editor and see if that option appears for you

1 Like

It worked after I reinstalled Addressables.