Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Why Unity Fetches ContentCatalog from local Only?

Discussion in 'Addressables' started by mekartikshah, Aug 2, 2019.

  1. mekartikshah

    mekartikshah

    Joined:
    Jan 10, 2017
    Posts:
    89
    I am facing a strange problem in fetching catalog from the server, I am loading my addressable from Http server and yesterday it works completely fine but today it keeps fetching the content catalog from local instead of the server.

    my play mode script is set to Packed Play Mode and I have created custom RemoteBuildPath and RemoteLoadPath with RemoteBuildPath at "ServerData/[BuildPath]" and RemoteLoadPath at "http://192.168.1.167/modulecontainer/[BuildTarget]" which is my HTTP server's address and I already enabled Build Remote Content Catalog with the same build and load path which you can take a look below.

    Screenshot 2019-08-02 at 16.00.22.png

    and here is the log of loading the addressable asset.

    Code (CSharp):
    1. Addressables - runtime data operation completed with status = Succeeded, result = UnityEngine.AddressableAssets.Initialization.ResourceManagerRuntimeData.
    2. Addressables - loading initialization objects.
    3. Addressables - loading content catalogs, 1 found.
    4. Addressables - loading content catalog from /Users/kartik/Documents/Unity Projects/Unity/EscaVel - Unity/Demos/Deployment/Addressables-Sample-master/Basic/Scene Loading/1.app/Contents/Resources/Data/StreamingAssets/aa/OSX/catalog.json.
    5. Addressables - added provider UnityEngine.ResourceManagement.ResourceProviders.LegacyResourcesProvider with id UnityEngine.ResourceManagement.ResourceProviders.LegacyResourcesProvider.
    6. Addressables - added provider UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider with id UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider.
    7. Addressables - added provider UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider with id UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider.
    8. Addressables - initialization complete.
     
  2. mekartikshah

    mekartikshah

    Joined:
    Jan 10, 2017
    Posts:
    89
    @Favo-Yang buddy can you help me with this problem?
     
  3. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Are you sure your sever is running and you can connect to it? And the IP hasn't changed? Sounds like addressables tried that path and could not find the file.
     
  4. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
  5. MoctezumaDev

    MoctezumaDev

    Joined:
    Aug 14, 2013
    Posts:
    53
    I think, I'm having the same issue or a similar one:

    I've been trying to test the update workflow just to be sure I understand how content updates would work but I'm having issues with very simple things.
    1. I created the base content with a catalog.json... this also generated a .bin file.
    2. Then I built a Windows application.
    3. I didn't upload the assets (I wanted to get the error that it could not reach the remote content)
    4. Runned the application and got the errors as expected.
    5. I uploaded my data to an S3 bucket
    6. Runned the applciation and everything worked as expected.
    7. Removed all the data from S3 and I made sure that nothing was reachable anymore
    8. Cleaned al cache data under AppData/LocalLow
    9. Runned the application and the application somehow it's still getting the content
    I was having the same issue at the editor until I updated to the version 1.1.7. But the executables seems to still have the same issue, I'm very puzzled with this issue.

    Is there a way to log where the files are being downloaded/loaded form?

    By the way, the following line of code doesn't seem to be working as expect:

    Caching.ClearCache();
     
  6. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    Library\PackageCache\com.unity.addressables@1.1.7\Runtime\ResourceManager\ResourceProviders\AssetBundleProvider.cs

    Line 178, BeginOperation()
    Code (CSharp):
    1.         private void BeginOperation()
    2.         {
    3.             string path = m_ProvideHandle.Location.InternalId;
    4.             Debug.Log(path); # add this line
     
    MoctezumaDev likes this.
  7. MoctezumaDev

    MoctezumaDev

    Joined:
    Aug 14, 2013
    Posts:
    53
    @Favo-Yang thanks for the suggestion... but somehow my code is not hitting that line.

    I'm using:

    Code (CSharp):
    1.  
    2. var sceneLoading = reference.LoadSceneAsync();
    3. while (!sceneLoading.IsDone)
    4. {
    5.       Debug.Log(sceneLoading.PercentComplete);
    6.       yield return null;
    7. }
    8.  
    then

    Code (CSharp):
    1. public AsyncOperationHandle<SceneInstance> LoadSceneAsync();
    A method which is exposed directly in UnityEngine.AddressableAssets.AssetReference and follow the code in AssetReference.cs:

    Code (CSharp):
    1.  
    2. /// <summary>
    3. /// Loads the reference as a scene.
    4. /// </summary>
    5. /// <returns>The operation handle for the scene load.</returns>
    6. public AsyncOperationHandle<SceneInstance> LoadSceneAsync()
    7. {
    8.      var result = Addressables.LoadSceneAsync(RuntimeKey);
    9.      m_Operation = result;
    10.      return result;
    11. }
    12.  
    I also wanted to check the Addressables.LoadSceneAsync method code but seems like the implementation is not exposed in the package so I can not follow the code, this doesn't look like being trully open sourced or maybe I'm missing again something. ;)
     
    Last edited: Aug 5, 2019
  8. MoctezumaDev

    MoctezumaDev

    Joined:
    Aug 14, 2013
    Posts:
    53
    @Favo-Yang I think my issue is similar but it might be something different, as far as I understant I'm not using the ResourceManager
     
  9. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    you should be able to follow it. The issue generally is that some IDE's won't understand how to follow links leaving you two options:
    1. copy the package into your project from "Library\PackageCache\com.unity.addressables@1.1.7" into "Packages/com.unity.addressables/". This will switch it to "development" mode, and all the code will work quite nicely with your IDE. I'd strongly suggest this as it'll play nicely with a debugger too.
    2. follow the path manually by reading the code, figuring out what you need next, and opening that file. It's a pain to do things this way for sure. If you do this, the Addressables.cs "LoadSceneAsync" will call into AddressablesImpl.cs "LoadSceneAsync" which then should be calling both into AssetBundleProvider.cs and SceneProvider.cs.

    The fact that you're not getting the debug log in AssetBundleProvider.cs is surprising. I can see that not being hit in fast or virtual mode, but in packed or the player it should.

    Have you turned on our verbose logging? You do that by setting "ADDRESSABLES_LOG_ALL" as a compiler directive in your player settings. With that on, we log all sorts of things, including the full path of the cached catalog we download.
    Addressables.LogFormat("Addressables - Saving cached content catalog to {0}.", localCachePath);