I load a scene in my AssetBundle like this:
IEnumerator AsyncLoad ()
{
using (var www = new WWW("file://" + Application.dataPath + "/AssetBundles/scenes"))
{
yield return www;
var bundle = www.assetBundle;
Application.LoadLevel("Scene1");
bundle.Unload(false);
Debug.Log("done");
}
}
The problem is sometimes Application.LoadLevel(“Scene1”); works fine and sometimes Scene1 is empty. What’s wrong here?
Side note: I noticed LoadLevel destroys the current scene before loading, so the lines after LoadLevel are not being executed (since the script was destroyed). As I need to unload the asset bundle in order to use it again another time, what’s the solution?