Unity package The same file hash is different

Source: Internet
Author: User

Use Unity3d do game development, basic will involve the resources version management and update, the following is to do the process encountered a small problem, record for reference.

And often used to mark the source version of the method has the calculation file hash, VCs version, etc., the file hash calculation found that the same resource file each time packaging into a assetbundle after the hash is not the same, this is not scientific ah, this is basically a waste of a hash version of the method of marking.

Check the data, found the AssetBuildPipeline.BuildAssetBundle interface options parameters, you can add an item BuildAssetBundleOptions.DeterministicAssetBundle . This will ensure that the assetbundle is identified with a unique hash, and if this parameter is not added, a different ID is generated for each build Assetbundle

Now post a My simple package script:

[MenuItem ("tools/Packing Setting_client")] Public Static voidbuildwd_settingclient () {varSetting_client = Assetdatabase.loadassetatpath ("assets\\setting_client.bytes",typeof(Object)); //NOTE This path is written dead first    varSavepath =@"E:\xxx_online\data\setting_client.ab"; if(Setting_client! =NULL) {Buildpipeline.buildassetbundle (setting_client,NULL, Savepath, Buildassetbundleoptions.uncompressedassetbundle| Buildassetbundleoptions.completeassets |Buildassetbundleoptions.deterministicassetbundle, buildtarget.standalonewindows); Debug.Log ("package successful, file in:"+Savepath); }    Else{debug.logerror ("Please check that setting_client.bytes is not found."); }}

Partial content reproduced from: http://blog.dou.li/Unity3D-AssetBundle-Build-Hash-No-Same.html

Unity package The same file hash is different

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.