Unable to download from web server

I have a single addressable asset that has been built and hosted on my web server. I have set up my bundle group’s load path to point to the location just as I’ve seen in other forum posts.

The difference though is that I need this to work for when my Unity project has no registered addressable assets. The original asset itself shouldn’t even exist in the assets folder. This is because my end goal is an empty executable platform which can search for available assets on my server and download them using the settings and catalogues hosted online. Here is my code:

private void Start ()
    {
        Addressables.InitializationOperation.Completed += InitializationCompleted;
    }

    private void InitializationCompleted (IAsyncOperation<IResourceLocator> obj)
    {
        Debug.Log ("Initialization Complete");

        Addressables.LoadCatalogsFromRuntimeData (settingsPath).Completed += LoadCatalogsCompleted;
    }

    private void LoadCatalogsCompleted (IAsyncOperation<IResourceLocator> obj)
    {
        Debug.Log ("Load Catalogs Complete");

        StartCoroutine (LoadModel ());
    }

    private IEnumerator LoadModel ()
    {
        IAsyncOperation<GameObject> downloadOperation = Addressables.LoadAsset<GameObject> (address);

        Debug.Log ("Started Download");
        yield return downloadOperation;

        if (downloadOperation.Result != null)
        {
            loadedAsset = downloadOperation.Result;
            Instantiate (loadedAsset);
           
            Debug.Log ("Success!");
        }
        else
        {
            Debug.LogError ("Failed to load object");
        }
    }

The download only ever seems to work when the addressable asset is actually registered into a group with the correct address and remote load path which goes against the whole point of what I’m trying to achieve. Even though I am telling it to load catalogues from runtime data.

I also get an error saying that the catalogue.json and .hash files could not be loaded from my web server. Is there any way to download addressables remotely when there is nothing present in even the local group at run time?

1 Like

Let me see if I understand what’s going on exactly…

  • you have two unity projects
  • one of them (projectA) has an asset, that you’ve marked as addressable, built, and put the results up on a server.
  • The other (projectB) has no assets marked as addressable, but does have an addressable group set up to point to that server.
  • When you run projectB, you have it load the catalog from projectA, then attempt to load assets from projectA via that catalog

How close am I to understanding your setup?

You’re absolutely correct. My impression was that the remotely stored settings.json file loaded from LoadCatalogsFromRuntime would allow the addressable system to “just work” but I guess I’m either missing something or trying to do something the system wasn’t meant to do.

Without loading bundles from remote catalogs my whole project kind of just fails unless there’s an alternative method to downloading assets to an empty addressables runtime.

Given that those are correct, I think your setup may be a little off. Each group defines how content inside it gets built and loaded. So an empty group (in projectB) will have no affect on anything, since it’s empty. The group in projectA is the one that needs to be set up to load from the server. Then the catalog from projectA needs to be loaded in projectB, and it should “just work”.

If this isn’t working, the best thing may be to file an official bug through the Unity editor so that you can more easily attach all your projects.

What you’ve said also describes what I’m doing. So projectA’s load path is set to be the same path as where projectB is getting its catalogue from. Where else in my set up could I be going wrong? Do I need to use a particular schema or do something else in the settings? I’d just like to eliminate all obvious issues on my end before reporting a bug.

The one thing you could to do help pinpoint the problem would be to create a dummy scene in projectA, that loads the thing you care about. Just to make sure it can. If projectA’s data is properly built and load-able from the server, then there could be a bug in our external catalog loading system.