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. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

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:
    480
    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:
    480
    Nobody, not even a Unity employee?