Instructions on how to generate CRC checksums to use with LoadFromCacheOrDownload

Hi there,

I’m looking for instructions on how to generate the CRC32 checksums, which are used to verify the downloaded file integrity using WWW.LoadFromCacheOrDownload.

I want to store a list of CRCs, which are pregenerated at build time and which map to the assetbundle filenames I want to download and have verified. ( Simplified I use CRC32(generated assetbundlefile) ).

Though the precreated CRCs of the assetbundle files never matches the one that the LoadFromCacheOrDownload - method is expecting.

Unfortunately, the documentation at Unity - Scripting API: WWW.LoadFromCacheOrDownload is broken at this point - look at the crc - parameter description, it suddenly stops.

The only clue I can get out of the documentation that the CRC is calculated for the “uncompressed contents”.

So, can anyone help how to accomplish generating a CRC32, which is the same LoadFromCacheOrDownload expects?

Hi,

In Unity 4.1 it isn’t possible to get the CRC directly. This is going to be added to the API for a future release, to make it possible to get the CRC value when building the AssetBundle.

For now the workaround is this:

  • Build your AssetBundle as usual.
  • Try to load it passing a dummy CRC value.
  • The correct CRC value will be printed in the Editor.log : Unity - Manual: Log files
  • Replaced the dummy CRC value with the one printed CRC in the log.

Answers post : Generating LoadFromCacheOrDownload CRC value - Questions & Answers - Unity Discussions