I have a bunch of Asset Bundles. I load the generic Asset Bundle Manifest to get the names of all of my asset bundles. I want to load only a specific asset from the bundle, but I need to retrieve the names of the assets so I can choose which one. The names of these assets are in the asset bundles manifests associated with each asset bundle.
How can I load just the manifest for a particular asset bundle?
This is the closest I have come, but it does not work:
private IEnumerator LoadAssetNames()
{
foreach (var bundleName in assetBundleNames)
{
string url = "my://server/" + bundleName + ".manifest";
var www = UnityWebRequest.GetAssetBundle(url);
yield return www.Send();
if (www.isError)
{
Debug.LogError(www.error);
yield break;
}
var bundle = ((DownloadHandlerAssetBundle)www.downloadHandler).assetBundle;
www.Dispose();
assetNames[bundleName] = bundle.GetAllAssetNames();
}
}
It returns to me a failed to decompress error:
Error while downloading Asset Bundle: Failed to decompress data for the AssetBundle 'my://server/bundleName.manifest'.
I can download the manifest directly as a string or set of bytes, but then how can I cast it to an AssetBundleManifest
?