Using Remote Server in Editor

Hi there, I’m just playing around with Addressables to start understanding them and there is something I cannot understand.

I’m having a local python server pointing to a directory in my Desktop at http://0.0.0.0:8080

I’m having this group


Packed Assets are remote and has this Profile

And my settings are

And I’m running this at Start

Addressables.LoadResourceLocationsAsync("levels").Completed += handle =>
        {
            foreach (var resourceLocation in handle.Result)
            {
                txt.text += resourceLocation.PrimaryKey + "\n";
                Debug.Log(resourceLocation.PrimaryKey);
            }
        };

So I did the following test.

And the server is being hit by the app because is logging the following:

127.0.0.1 - - [27/Jul/2020 22:21:02] code 404, message File not found
127.0.0.1 - - [27/Jul/2020 22:21:02] “GET /StandaloneOSX/catalog_2020.07.28.01.05.43.hash HTTP/1.1” 404 -
127.0.0.1 - - [27/Jul/2020 22:28:06] code 404, message File not found
127.0.0.1 - - [27/Jul/2020 22:28:06] “GET /StandaloneOSX/catalog_2020.07.28.01.05.43.hash HTTP/1.1” 404 -
127.0.0.1 - - [27/Jul/2020 22:33:03] code 404, message File not found
127.0.0.1 - - [27/Jul/2020 22:33:03] “GET /StandaloneOSX/catalog_2020.07.28.01.05.43.hash HTTP/1.1” 404 -
127.0.0.1 - - [27/Jul/2020 22:33:12] code 404, message File not found
127.0.0.1 - - [27/Jul/2020 22:33:12] “GET /StandaloneOSX/catalog_2020.07.28.01.05.43.hash HTTP/1.1” 404 -

Another question:

How can use the remote server in the editor?
I would like to test the development and production flow in my editor

1 Like

I found that changing the port to 8080 in Asset Management/Addressables/Hosting is hitting the server but I don’t have any bundle there and somehow data is being loaded

6139776--669972--upload_2020-7-27_22-55-22.png

In the addressables groups window, change play mode script to Use Existing Build.

I did it, but somehow the editor is still reading from Library/com.unity.addressables/aa./[BuildTarger]
If I delete the catalog inside that folder the player then will tell me that iI have to build the bundles.

Rebuild the asset bundles after changing the path in the profile. The actual URI of the assets gets written in the catalogue at build time.

Yes I did it also :confused:
Is there a way to test to a remote server in editor? I mean, does it work? Or Unity uses a cache or something like that?

1 Like

Yes, I am literally doing it as we speak. I don’t think I did anything differently to what you are saying here though. Take a peek inside the catalogue and settings files and see where they are pointing at.

1 Like

I will check it! Thanks @AlkisFortuneFish

I’m not getting how Unity still know how to get the asset.
I did this test.

  • Demo script with an AssetReference pointing to a scriptableObject
  • My server running
  • built for remote
  • catalog is pointing to myserver/ios/xxxxx.bundle
  • I hit play and a I see some GET in my server with 200 so everything is ok
  • Now i delete my iOS folder in my server and I think it should fail
  • I hit play again and I can access to the scriptable but my server is throwing 404

@AlkisFortuneFish are you able to make a load async fail if there is no data in the server?

If it fails to get from remote, it falls back to cache. Unfortunately, there’s currently no way to clear the addressables cache and no way to tell it to ignore cache. If it doesn’t exist in cache (i.e. the first time you try to download), then it will fail completely.

Ah, so, the data is cached after initial download. Under normal circumstances, that is fine. For testing, you can clear the cache. To clear the cache for individual assets, use Addressables.ClearDependencyCacheAsync(). To clear the whole cache for testing purposes, just go to your AppData folder, it should be in one of the subfolders of your app folder. Keep in mind that the cache is specific to the hash of your assets, so if your assets change they will be redownloaded anyway.

Edit: Actually, try UnityEngine.Caching.ClearCache();