Search Unity

How could I known which asset bundle is built when I invoke BuildPipeline.BuildAssetBundles?

Discussion in 'Asset Bundles' started by watsonsong, Apr 16, 2018.

  1. watsonsong

    watsonsong

    Joined:
    May 13, 2015
    Posts:
    465
    I build the asset bundle without BuildAssetBundleOptions.ForceRebuildAssetBundle, so each time I invoke the BuildPipeline.BuildAssetBundles only a part of asset bundle is actual build.
    I add a post process to encrypt the built asset bundles. Each time I get the AssetBundleManifest from the BuildPipeline.BuildAssetBundles and encrypt all asset bundles.

    But there has a problem, the old asset bundle that not built will encrypt twice, that will make I encrypt one file more than one times, and that make a incorrect result.

    Is there any way to find out which asset bundle is new build when I invoke the BuildPipeline.BuildAssetBundles?
     
  2. M_R

    M_R

    Joined:
    Apr 15, 2015
    Posts:
    555
    1) don't overwrite. that way your encrypted bundles have one layer of encryption, even if the source is processed multiple times
    2a) you can check the file timestamp (from your os) and only process new files, or
    2b) you can keep the old manifest and compare the hash of each bundle. different hash => bundle is rebuilt.
     
unityunity