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

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?

Nobody, not even a Unity employee?

Hello, i found some solutions:

Unity asset bundle file is UnityFS file.
You can try to read this file as binary.

Follow this reference
(C#) AssetStudio/AssetStudio/BundleFile.cs at master · Perfare/AssetStudio · GitHub
or (Java) disunity/disunity-core/src/main/java/info/ata4/junity/bundle at master · ata4/disunity · GitHub

crc is CRC-32 checksum of all unpacked files in bundle (crc32 hash of all of them)

And CRC-32 code reference