Hi :)
I can't get my asset bundle scene to works! It works only in editor mode, when i'm following the example in documentation.(simulation mode enable)
I have a scene, and menu with button in it (each button points to different scenes). When i click a button i want to go to the selected scene.
Everything work fine, both in editor and on my android device.
So i want to make my scenes to be asset bundles and to load them outside the build.
// Load the AssetBundle file from Cache if it exists with the same version or download and store it in the cache
using (WWW www = WWW.LoadFromCacheOrDownload(BundleURL, version))
{
yield return www;
if (www.error != null)
throw new Exception("WWW download had an error:" + www.error);
AssetBundle bundle = www.assetBundle;
//AssetBundleManager.LoadLevelAsync(sceneAssetBundle, sceneName, true);
if (sceneAssetBundle == "")
Instantiate(bundle.mainAsset);
else
Instantiate(bundle.LoadAsset(sceneAssetBundle));
//bundle.LoadAssetAsync(sceneAssetBundle);
Debug.Log("successfull!");
// Unload the AssetBundles compressed contents to conserve memory
bundle.Unload(false);
} // memory is freed from the web stream (www.Dispose() gets called implicitly)
this way nothing happens....
I can get scenes loaded in simulation mode with this code, but this works only in editor
AssetBundleLoadOperation request = AssetBundleManager.LoadLevelAsync(sceneAssetBundle, levelName, isAdditive);
if (request == null)
yield break;
yield return StartCoroutine(request);
Can some one give me an advice how to load asset bundle scene ?!?! Can't find any working example...
THANKS A TON :)
↧