Generating LoadFromCacheOrDownload CRC value

Unity 4 supports a CRC value on assets downloaded using WWW.LoadFromCacheOrDownload:

The documentation says “Look at the error string returned to see the correct CRC value to use for an AssetBundle.” This seems to be a bit of a silly way to figure out the CRC for asset bundels, especially when we have a large and changing number of them. Is there a better way to determine the CRC for an asset bundle?

In Unity 4.1 it isn’t possible to get the CRC directly from the API. This is going to be added to 4.3 as an optional “out” parameter to BuildPipeline.BuildAssetBundle, so that you can get the CRC value when building the AssetBundle.

For 4.1 and 4.2, the workaround is this:

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