Search Unity

Bug How to Fix CRC Mismatch

Discussion in 'Addressables' started by dayflygirl, Jan 14, 2022.

  1. dayflygirl

    dayflygirl

    Joined:
    Aug 26, 2017
    Posts:
    4
    upload_2022-1-14_12-5-25.png

    Please tell me how to solve CRC Mismatch

    Even after clearing the entire cache and downloading again, it fails.

    I tried calling Addressables.ClearDependencyCacheAsync to no avail.

    Addressables.DownloadDependenciesAsync() is Try-Catch cannot be used.......

    Please tell me how to force clear the asset cache and download it again.

    I'm going crazy.....

    help me..



    + I'm using windowsOS, editor version 2021.2.7f1 and addressables version 1.19.17
     
    Last edited: Jan 14, 2022
  2. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    Without knowing your project setup and workflow it's difficult to advise something more concrete.

    A workaround: There are options to disable CRC checking in the Content Packing & Loading schema of a given AddressableAssetGroup. You can set it to be completely disabled, or to only disable it when loading cached AssetBundles. That should at least give you a path forward if nothing else.

    A couple of questions/thoughts:
    • Are you building/re-building any of these bundles using different versions of Unity? This shouldn't be a problem anymore but there were issues in the past.
    • Are you loading asset bundles that have been built using the project on a different machine? We've seen this type of issue arise in the past.
    • If you're hosting remote bundles, make sure that you've uploaded all the newly built bundles, catalog.json and catalog.hash files that were generated for remote content. This is really only likely to cause your issue after doing a content update but it could be worth double checking.
    You mention trying to clear the cache with no success. If you're not already, try using the
    Code (CSharp):
    1.  public static AsyncOperationHandle<bool> ClearDependencyCacheAsync(object key, bool autoReleaseHandle)
    version of the method. Once it's finished check the bool result and make sure it isn't false, indicating the cache couldn't be cleared for some reason.

    If you want to affect the AssetBundle cache directly, try
    Code (CSharp):
    1. Caching.ClearCache()
    . It is the "nuclear" option. The method also returns a bool that indicates if the operation was successful. If it isn't successful it's possible that some of the bundles in that cache are loaded.
     
  3. dayflygirl

    dayflygirl

    Joined:
    Aug 26, 2017
    Posts:
    4
    1. Disabling CRC solves it, but I want to use CRC.
    2. I am always updating to the latest version.
    3. The build was done only on my PC. Oh, I recently upgraded to Windows 11 Pro.
    I wonder if this has anything to do with it.
    4. I used remote bundles and always checked for catalog updates.
    5. Both Caching.ClearCache and ClearDependencyCacheAsync succeeded.
    But when I re-download it after rebuild, I get a mismatch error as shown in the picture.

    = question
    I think it was a CDN purging issue. After changing the hashes of all AssetBundles, building and it worked.

    But I have a question...

    1. After clearing all caching on the build PC (Clean AppData and call Caching.Clear), I did a bundle build ( addressable group -> build > new build > default build script ), but the hash key of the resulting file was the same. Is there any other way to change it?

    2. I want to notify the user after a CRC mismatch and force them to download again, but I can't use try-catch in IEnumerator.
     
    Last edited: Jan 18, 2022
  4. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    I'm glad you got it to work! I did ask one of our build engineers and they said upgrading to Win 11 could cause CRC mismatches depending on what type of assets you're using. Not saying that's what caused your issue, but just for anyone else that's in a similar situation.

    1. I'm not sure if you mean the AssetBundles or catalog when you say "resulting file". Typically hash changes only come from changes in the assets. If changing an asset isn't an option, you might try going into the AddressableAssetSettings and turning on Unique Bundles IDs. Even with unchanged assets, the first build after turning this on should result in newly hashed AssetBundles. I don't believe it forces new hashes _every_ time.

    2. So, there actually should be logic in place that forces as least one retry when a cached asset bundle can't be loaded. I just took a look at the code and it might be that there's a bug in that if your Retry Count is greater than 0 (which is very confusing, but it looks like the cached bundle only gets cleared if your Retry Count is 0. Otherwise the retries are attempted but the invalid bundle is still cached so it just keeps trying to load that).

    That doesn't help you in the moment, however. You can try checking the `OperationException.Message` on the AsyncOperationHandle and parse it for "CRC Mismatch". Then, if that message is detected, you should be able to clear the cache and re-download.

    If you're uploading a new remote catalog, make sure you're also uploading the corresponding .hash file alongside it. If the catalog changes, but that hash files doesn't, the new catalog won't get downloaded (which contains the crc data for the asset bundles). If you are uploading a new catalog, with it's hash file, and new AssetBundles, and the catalog hash isn't changing (ie the value in the .hash file is unchanged) but the AssetBundles are different, then this sounds like a bug in the build.
     
  5. merrythieves

    merrythieves

    Joined:
    Apr 28, 2021
    Posts:
    14
    I can't wait to end my 3 hour google search for how on earth to actually disable crc, something it seems like everyone else has an inherent inborn instinctual ability to do without the aid of any kind of useful documentation from Unity.
     
  6. GastonC

    GastonC

    Joined:
    Aug 26, 2012
    Posts:
    38
    @merrythieves Open the AddressableGroups tab, select any group you want, and in the inspector, you will find Asset Bundle CRC, and you can set it to 'Disabled'

    upload_2022-4-25_10-47-38.png
     
    Claytonious likes this.
  7. moayad-jawaker

    moayad-jawaker

    Joined:
    Mar 4, 2020
    Posts:
    10
    Hello guys,
    Our project was on unity 2019.4.16 and we upgraded to 2020.3.37 then 2020.3.39 and everything was perfect with no error.

    because we moved from 2020 to 2019 and vice versa, I got the CRC errors on the editor but the current release on the store (Android and iOS) with no errors.

    Android platform fixed with me by coincidence

    First, I tried to increase the version of the catalog and upload the bundles to the server, but nothing worked. I reverted everything as before and it works, but I don't know why. I think fixed after uploading new files to the server

    I tried the same thing on the iOS platform but nothing worked.

    In the end, I tried to re-upload one bundle to check if it work or not, but, it works finally,

    So I fixed the problem by re-uploading the bundles to our server.
     
  8. JJRivers

    JJRivers

    Joined:
    Oct 16, 2018
    Posts:
    137
    Disabling the CRC checks does absolutely nothing when used in-editor.
     
  9. syuzani

    syuzani

    Joined:
    Dec 24, 2022
    Posts:
    1
    Try this to match the correct md5 checksum with your crc md5 checking files.
    certutil -hashfile <X:\YOUR_MISMATCH_CRC_PATH\FILENAME.md5> MD5
     
  10. dreamhst7

    dreamhst7

    Joined:
    Mar 27, 2014
    Posts:
    13
    I faced the same issue. I was helped by setting a checkbox in addressable settings Unique Bundle Id's