How to use profile and updating builds

I have 2 profiles; one for my local webserver one for the production web server.

I start development with my local webserver. I make a new build and then use the “Update a previous build” option to apply updates.

When I select my production profile I cannot run “Update a previous build”. I get the following error.

The current ‘Remote Catalog Load Path’ does not match load path of original player. Player will only know to look up catalog at original location. Original: https://www.xxxx.com/xxx/ServerData/WebGL Current: http://localhost/xxxl/ServerData/WebGL
UnityEditor.GenericMenu:CatchMenu (object,string[ ],int)

How can I update and build an updated version? Afaik, If I make a new build, It breaks the link to the catalog, and the game cannot use the updated version.

I think it is impossible for now. Addressables does not support multiple environment build like Dev, Int, UAT, and PROD using “Update a previous build” option.

I found the solution.

  1. Create a class like
namespace ForAddressable
{
    public class Settings
    {
        public static string RemoteAddress;
    }
}
  1. Set Addressable Profiles / Remote / Custom / Remote.LoadPath as {ForAddressable.Settings.RemoteAddress}
    Don’t forget [ ] is used at build stage, {} is used at runtime.

  2. Make a new build. Addressable Groups/Build/New Build/Default Build Script.

  3. Set your address before you load anything. You may need to clear the cache on the editor.

  public enum Targets
        {
            Dev,
            Prod
        }

public Targets Target = Targets.Dev;

        public bool ClearCache;

void Start()
        {

#if UNITY_EDITOR

            if (ClearCache)
            {
                Caching.ClearCache();
            }

#endif


            if (Target == Targets.Dev)
            {
                RemoteAddress= "http://localhost/MyGame/ServerData/WebGL";
            }
            else
            {               
                 RemoteAddress= "http://www.myserver.com/MyGame/ServerData/WebGL";
            }

            var asyncOperationHandle = Addressables.LoadSceneAsync(SceneReference, LoadSceneMode.Single);
            asyncOperationHandle.Completed += AsyncOperationHandle_Completed;

            Debug.LogFormat("SceneInitialManager:Start:SceneLoading");
        }
  1. update your content

  2. Update your build. Addressable Groups/Build/Update a previous Build. Select AddressableAssetsData/Platform/addressables_content_state.bin