Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How can I check for AssetBundles integrity?

Discussion in 'Editor & General Support' started by eyalm, Aug 29, 2017.

  1. eyalm

    eyalm

    Joined:
    Dec 20, 2015
    Posts:
    42
    I'm using UnityWebRequest.GetAssetBundle(url,ver, crc);
    To get asset bundles.
    I know I can change the ver when I want to replace the assetbunle with a new one.
    The problem is: What if there is already an assetbundle downloaded and it is defected?
    How does unity know if it should redownload it or not? Will the user just get stuck with the old one and won't be able to play till next assetbundle version?
    I know you can pass a CRC number that is generated in the manifest file, but the documentations says:

    CRC: If nonzero, this number will be compared to the checksum of the downloaded asset bundle data. If the CRCs do not match, an error will be logged and the asset bundle will not be loaded. If set to zero, CRC checking will be skipped.

    I need it to check the current assetbundle CRC and if it bad to download the new one, but it seems it just check if the assetbundle via the url is good or not.

    How can I make this validation?
     
  2. eyalm

    eyalm

    Joined:
    Dec 20, 2015
    Posts:
    42
    Anyone? Unity's team?
     
  3. eyalm

    eyalm

    Joined:
    Dec 20, 2015
    Posts:
    42
    Bump! Unity team, please...
     
  4. eyalm

    eyalm

    Joined:
    Dec 20, 2015
    Posts:
    42
    Bump... :|
     
  5. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,998
  6. eyalm

    eyalm

    Joined:
    Dec 20, 2015
    Posts:
    42
    Thanks, but correct me if I'm wrong, this script checks if the cached AassetBundle hash is identical to the hash file in the manifest file, but it doesn't generate a new one from it at runtime.
    So if the AassetBundle is corrupted but still have that string inside its text, the script will think that the local version is good.

    I've noticed that you are using the Get method and not the GetAssetBundle method which is better for downloading AssetBundles ( From the documents:
    GetAssetBundle Creates a UnityWebRequest optimized for downloading a Unity Asset Bundle via HTTP GET.)

    Thanks for helping BTW!
     
    Last edited: Sep 6, 2017