Hi,
Today I decided to give AssetBundles a try, but I ran into a problem …
I did the following:
- According to the new Manual for AssetBundles, I tagged all my Scenes (for a test) for a single AssetBundle.
- I built it
- I “uploaded” it to my localhost so I could try the approach via www class.
So far, so good. Now to the problems:
I use the script below to load the AssetBundle and Instantiate a button for each Scene in the Bundle. This is working so far. The attached button script gets the name of the level in a string and if it is clicked it should just load the level. But instead of doing so it gives me the following error:
The code for loading the asset:
#pragma strict
var ButtonPrefab : GameObject;
var ButtonCounter : int;
var Bundle : AssetBundle;
function Start()
{
var www : WWW = new WWW("http://localhost/Bundles/levels");
yield www;
Bundle = www.assetBundle;
Objects = Bundle.LoadAllAssets();
var Btn : GameObject;
for(var a : String in Bundle.GetAllScenePaths())
{
Btn = GameObject.Instantiate(ButtonPrefab);
Btn.name = ButtonCounter.ToString();
Btn.GetComponent(Button).lvlstring = a;
Btn.transform.SetParent(this.transform, false);
ButtonCounter++;
}
}
I tried to do some research but i found nothing that fit my problem. Maybe someone of you could help me?
I’m looking forward for your answers!
Greetings
Gushus