2
\$\begingroup\$

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?

\$\endgroup\$
2
  • \$\begingroup\$ will it work if you replace the .manifest to .unity3d? \$\endgroup\$ Feb 24, 2017 at 17:05
  • \$\begingroup\$ Sorry to necro this. But did you ever figure out how to do this? Trying to do the same thing. \$\endgroup\$
    – ribsies
    Apr 22, 2018 at 1:16

1 Answer 1

0
\$\begingroup\$

Not sure if this is relevant or not any more but loading a manifest- according to Unity's docs requires loading the bundle and then grabbing the manifest.

string url = "my://server/" + bundleName

Instead of

string url = "my://server/" + bundleName + ".manifest"

Using AssetBundles

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .