I've been googling all day for a solution to this problem.
How do you load a scene through an asset bundle? Loading the scene directly after getting www.AssetBundle gives me error
`couldn't be loaded because it has not been added to the build settings or the AssetBundle has not been loaded.`
Any attempt at loading the assetbundle (eg. www.AssetBundle.LoadAllAssets()); gives me error
`InvalidOperationException: This method cannot be used on a streamed scene AssetBundle.`
This is my script
//Download asset bundle
WWW bundleWWW = WWW.LoadFromCacheOrDownload(sceneURL, 1);
yield return bundleWWW;
assetBundle = bundleWWW.assetBundle;
if (assetBundle.isStreamedSceneAssetBundle) {
string[] scenePaths = assetBundle.GetAllScenePaths();
string sceneName = System.IO.Path.GetFileNameWithoutExtension(scenePaths[0]);
assetBundle.LoadAllAssets(); //InvalidOperationException: This method cannot be used on a streamed scene AssetBundle.
SceneManager.LoadScene(sceneName); //couldn't be loaded because it has not been added to the build settings or the AssetBundle has not been loaded.
}
↧