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