Search Unity

Addressables.CheckForCatalogUpdates does not return error if remote hash is not reachable

Discussion in 'Addressables' started by ao_196419, Jan 16, 2020.

Thread Status:
Not open for further replies.
  1. ao_196419

    ao_196419

    Joined:
    Jul 6, 2018
    Posts:
    17
    Hi all, I am working on some error handling in the remote bundle update flow. It seems like the if I use Addressables.CheckForCatalogUpdates to check if remote hash is changed, if the remote hash is missing for any reason (e.g. 404, server failure), addressables will not throw any error and just use local catalog directly.

    I double checked the source code in CheckCatalogOperation and it seems like the case:
    Code (CSharp):
    1.  protected override void Execute()
    2.         {
    3.             var result = new List<string>();
    4.             for (int i = 0; i < m_DepOp.Result.Count; i++)
    5.             {
    6.                 var remHashOp = m_DepOp.Result[i];
    7.                 var remoteHash = remHashOp.Result as string;
    8.  
    9.                 if (!string.IsNullOrEmpty(remoteHash) && remoteHash != m_LocalHashes[i])
    10.                 {
    11.                     result.Add(m_LocatorInfos[i].Locator.LocatorId);
    12.                     m_LocatorInfos[i].ContentUpdateAvailable = true;
    13.                 }
    14.             }
    15.             Complete(result, true, null);
    16.         }
    This does not make sense to me. Addressables should at least let people to decide if local catalog can be directly used if remote hash cannot be reached, but not silence all error behind the hood. Please let me know if I missed anything, thanks!
     
    anisimovdev likes this.
  2. ao_196419

    ao_196419

    Joined:
    Jul 6, 2018
    Posts:
    17
    Similar case goes to
    Addressables.UpdateCatalogs()
    .

    If catalog update is needed (i.e. remote hash updated) but remote catalog is missing, the following exception will be thrown (note that this is not probably thrown through the asyncOperationHandle.OperationException, but an exception thrown by UpdateCatalogsOperation):

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEngine.AddressableAssets.UpdateCatalogsOperation.Execute () (at Library/PackageCache/com.unity.addressables@1.5.0/Runtime/Initialization/UpdateCatalogsOperation.cs:63)
    3. UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].InvokeExecute () (at Library/PackageCache/com.unity.addressables@1.5.0/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:401)
    4. UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].<.ctor>b__27_0 (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle o) (at Library/PackageCache/com.unity.addressables@1.5.0/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:102)
    5. DelegateList`1[T].Invoke (T res) (at Library/PackageCache/com.unity.addressables@1.5.0/Runtime/ResourceManager/Util/DelegateList.cs:69)
    6. UnityEngine.Debug:LogException(Exception)
    7. DelegateList`1:Invoke(AsyncOperationHandle) (at Library/PackageCache/com.unity.addressables@1.5.0/Runtime/ResourceManager/Util/DelegateList.cs:73)
    8. UnityEngine.ResourceManagement.ResourceManager:Update(Single)
    9. MonoBehaviourCallbackHooks:Update() (at Library/PackageCache/com.unity.addressables@1.5.0/Runtime/ResourceManager/Util/MonoBehaviourCallbackHooks.cs:19)
     
  3. ao_196419

    ao_196419

    Joined:
    Jul 6, 2018
    Posts:
    17
    Still looking for a solution for this problem...
    I am afraid this will cause a big problem for games that requires all players to have sync data. I really hope Unity can provide a fix or a workaround asap :(
     
  4. Shaunyowns

    Shaunyowns

    Joined:
    Nov 4, 2019
    Posts:
    328
    ao_196419 likes this.
  5. ao_196419

    ao_196419

    Joined:
    Jul 6, 2018
    Posts:
    17
    Hi, is there any updates for this issue?
     
Thread Status:
Not open for further replies.