I try to load Unity scene from AssetBundle with following code:
using (WWW www = WWW.LoadFromCacheOrDownload("http://127.0.0.1:8080/unity/test-scene", 1))
{
yield return www;
if (www.error != null)
{
Debug.Log("Load Error " + www.error);
}
AssetBundle bundle = www.assetBundle;
Object[] loadObjectList = bundle.LoadAllAssets();
foreach(Object tempObj in loadObjectList)
{
Debug.Log("Object = " + tempObj);
}
}
For scene base bundles I always got 0 elements for loadObjectList
array.
If I call bundle.GetAllScenePaths()
function I got scene path(s), but if I try to load those scene(s) using SceneManager.LoadScene()
function I got following error message:
"(-1) Scene couldn't be loaded because it has not been added to the build settings or the AssetBundle has not been loaded".
Did someone know how to load scene from AssetBundle or is this is limitation of Unity?