Instantiate Everything in AssetBundle

Hi… I’m trying to do something that I thought was relatively simple, but is proving to be a bit difficult. I just want to download an assetbundle, load everything in it (LoadAll) and then instantiate all of those items.

I am using UnityScript, this is what I have so far:

var baseUrl : String;

function Start () {
	var downloadUrl : String = baseUrl + "bundle.unity3d";
	var www = WWW (downloadUrl);
    yield www;
    www.assetBundle.LoadAll();
}

So it loads everything, but I can’t find how to instantiate it all.

Hopefully it’s a simple fix!

Thanks!

Since you can only load by string, you’d probably want to have your bundle’s main asset be an initializer with a list of all the names of all the objects in the bundle, and in its Start function, have it instantiate everything. then this code just has to instantiate the main asset. you probably need a globally accessible reference to the asset bundle to allow the initializer to actually see it, too.

or build a text file into the bundle which lists everything, and use that (Load the text file, then instantiate everything it lists). that might be simpler.