- Home /
 
 
               Question by 
               lukasz1500100900 · Aug 22, 2015 at 06:17 PM · 
                assetbundlewwwbundlesunload  
              
 
              Unload asset bundle make problem
Hello, When I'm using www.assetbundle.unload(false), this clear all my loaded assets. We need to use unload infos about asset bundles, because we have very big scene. I spend a lot of hours to find resolve,
IEnumerator LoadLevel(string sceneName, string sceneBundleName) {
             string pathToLoad = "file://" + Application.persistentDataPath + "/SCENA/scenes/" + sceneBundleName;
             using (WWW www = WWW.LoadFromCacheOrDownload(pathToLoad, 12)) {
                 yield return www;
                 if (!string.IsNullOrEmpty(www.error)) {
                     Debug.Log("LOAD SCENE ERROR:" + www.error);
                     yield break;
                 }
 
                 foreach(string scenePath in www.assetBundle.GetAllScenePaths())
                     Debug.Log(scenePath);
 
                 Application.LoadLevel(sceneName);
                 yield return null;
 
                 // MAKE PROBLEM (sometimes didn't find scene)
                 www.assetBundle.Unload(false);
                 www.Dispose();
             }
         }
 
  // LOADING ASSETS BEFORE LOAD SCENE
         IEnumerator WWWLoadAssetBundle(string path) {
             // Commented, but with this I also had problem with unload.
             //using (WWW www = WWW.LoadFromCacheOrDownload("file://" + path, 12)) {
             using (WWW www = new WWW("file://" + path)) {
                 yield return www;
 
                 try {
                     UnityEngine.Object[] assets = www.assetBundle.LoadAllAssets();
                     _lockedLoadingAssetBundle = false;
                 } catch (System.Exception e) {
                     _lockedLoadingAssetBundle = false;
 
                     Debug.Log("LOAD ASSET ERROR:" + e.Message);
                     _errorLoadingList.Add(path);
                 }
 
                 // MAKE PROBLEM
                 www.assetBundle.Unload(false);
                 www.Dispose();
             }
         }
 
                
               
               Comment
              
 
               
              Your answer