Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Is there any notification when InitializeAsync fails to load remote catalog.json?

Discussion in 'Addressables' started by zhuxianzhi, Sep 4, 2019.

  1. zhuxianzhi

    zhuxianzhi

    Joined:
    Mar 30, 2015
    Posts:
    31
    InitializeAsync is always successful, even if the remote address is wrong, it will also load the local catalog.json.

    Code (CSharp):
    1.    var asyncOperationHandle = Addressables.LoadContentCatalogAsync("http://127.0.0.1/catalog.json");
    2.         asyncOperationHandle.Completed += handle =>
    3.         {
    4.             if (asyncOperationHandle.Status != AsyncOperationStatus.Succeeded)
    5.             {
    6.                 Debug.Log("Error");
    7.             }
    8.         };
    This seems to be a solution, but how do I get the remote address of catalog.json?
    Do I need to load the local settings.json to get the remote address of catalog.json?

    Thanks in advance
     
  2. NSWell

    NSWell

    Joined:
    Jul 30, 2017
    Posts:
    26
    Last edited: Sep 6, 2019
  3. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    329
    I checked the source code, the system parsed settings json and stores the
    CatalogLocations into Addressables.ResourceLocators[0]. You probably can get the catalog path from key
    AddressablesMainContentCatalogRemoteHash.

    Is it?
     
  4. NSWell

    NSWell

    Joined:
    Jul 30, 2017
    Posts:
    26
    Thanks for your reply and I have a question:
    How to add new groupd assets to my old application?
    I tried
    LoadContentCatalogAsync
    to load the catalog.json , but it is not work. I dont know what happened.
     
  5. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    329
    It's unnecessary to use LoadContentCatalogAsync if you mean just for downloading new bundles for old client. Just use remote catalog should be fine for most cases.

    You're right about LoadContentCatalogAsync only load file from local path. So if intend to use it for special purpose, you need to download the file your own.
     
  6. NSWell

    NSWell

    Joined:
    Jul 30, 2017
    Posts:
    26
    Thanks , Yes I tried . But It no work.
    When I add new group asset , I must re build the client , Becasue it can not loading from remote .
    ---
    1.When I change the material ,than build the bundle pack (remote build) , the old client it is not new asset( maybe a cache)
    2.When I add new Model (Character,DLC, new assets) , than build the bundle pack(remote build), same as not working properly

    This is my post:
    https://forum.unity.com/threads/hel...building-application-exe.740120/#post-4938383
     
  7. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    329
    @NSWell let's discuss on that thread then.