Skip to content

Instantly share code, notes, and snippets.

@wmiller
Created February 3, 2014 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wmiller/8792610 to your computer and use it in GitHub Desktop.
Save wmiller/8792610 to your computer and use it in GitHub Desktop.
XML Database LoadBundlesCo
private IEnumerator LoadBundlesCo(System.Action onComplete)
{
// Get bundle infos from the database
AssetBundleInfo[] bundleInfos = Database.Instance.GetEntries<AssetBundleInfo>();
// Load each bundle using the path in the bundle info
foreach (AssetBundleInfo info in bundleInfos)
{
string url = "file://" + AssetBundlePath + "/" + info.Name + ".unity3d";
Debug.Log("Loading bundle: " + url);
WWW www = new WWW(url);
yield return www;
// Add the bundle to our collection of loaded bundles
loadedBundles.Add(info.DatabaseID, www.assetBundle);
}
// Call the complete delegate
if (onComplete != null)
{
onComplete();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment