Search Unity

Way to check Asset Bundle CRC before attempting to load it?

Discussion in 'Asset Bundles' started by _Adriaan, Mar 31, 2022.

  1. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    481
    Hey there!

    I'm writing a fairly complicated asset bundle download system for my game and would like to check a downloaded Asset Bundle's CRC way before attempting to load it. One case where I need this is if my game crashes during downloading an asset bundle, because then the downloaded data will be written to disk which means there is a file there, but loading it with the CRC as an argument will fail – and in this case it would save me and the player some time and download data if I could have known this ahead of trying to load the asset bundle.

    I have many asset bundles and load them as needed, so loading all the downloaded bundles just to see if their CRC is correct is not an option. I couldn't find any public function in Unity's script reference that allows me to do a manual CRC check similar to the one the AssetBundle. I downloaded a CRC class from the internet, but it outputted in a different CRC uint, so apparently CRC isn't as straightforward as I was hoping it would be...

    Does anyone have a CRC class or other solution that would allow me to check a downloaded asset bundle's CRC?
     
  2. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    481
    Nobody, not even a Unity employee?
     
  3. Vlad0sZ

    Vlad0sZ

    Joined:
    Apr 9, 2017
    Posts:
    7