Hi,
I have stacked with multiple asset bundle system implementation. My idea was to split single but very large asset bundle ~200mb to many small bundles by 2-5mb. For bundle creation I use standard Unity Asset Bundle package.
Let’s see in details - before I had 4 files in bundle destination directory …/Asset Bundles/ios/
- bundleName
- bundleName.manifest
- ios
- ios.manifest
To define, should asset bundle be re-downloaded or not I used these methods
string bundleUri = _assetBundlesUri + "ios/bundleName";
string manifestUri = _assetBundlesUri + "ios/ios"
//Get the AssetBundle
AssetBundle manifestBundle = DownloadHandlerAssetBundle.GetContent(manifestRequest);
AssetBundleRequest assetRequest =
manifestBundle.LoadAssetAsync<AssetBundleManifest>("AssetBundleManifest");
yield return assetRequest;
//Get the AssetBundleManifest
AssetBundleManifest loadedAssetMf = assetRequest.asset as AssetBundleManifest;
//Get Hash128 from the AssetBundleManifest
Hash128 tempHash128 = loadedAssetMf.GetAssetBundleHash(bundleName);
//Pass to the IsVersionCached function
bool isVersionCached = Caching.IsVersionCached(bundleUri, tempHash128);
Somehow I couldn’t load “bundleName.manifest” directly to get Hash128, so I downloaded “ios” bundle directly to use GetAssetBundleHash. Everything worked fine with a single bundle, but nothing works with multiple.`There is no way to get Hash128 value for each bundle, because I can’t download bundle manifest same as can’t use “ios” bundle to get Hash.
How to deal with this case? Obvious solution would be to download each bundle manifest file and grab Hash from there, but I didn’t find a way to do it. Do I need to read hash from string and convert it to Hash128? As I remember I did it already in the beginning of bundle manager development, but Caching.IsVersionCached(bundleUri, tempHash128) always returned false.