- Home /
 
               Question by 
               TenshiYuna · Feb 22, 2013 at 09:27 PM · 
                iosassetbundlewwwassetbundlesmemory-leak  
              
 
              Assetbundle memory leaks
Hi guys! I'm making a game for the ios that has a customization feature. I'm currently using assetbundles and everything seems to be working fine. However everytime I load an asset the memory is not getting released, I'm still really new to this, so I'm probably doing something really basic. Here is the code I'm using to load the asset.
     /// <summary>
     /// Loads asset from Streaming Assets Folder
     /// </summary>
     /// <param name='url'>
     /// Url to load the asset from
     /// </param>
     /// <param name='obj'>
     /// A reference to the object that will recieve the loaded asset
     /// </param>
     public IEnumerator fromStreamingAssets(string AssetName, System.Action<GameObject> obj)
     {        
                 
         // Wait for the Caching system to be ready
         while (!Caching.ready)
             yield return null;
 
         string[] Asset = AssetName.Split('.');
 
         //Get the asset bundles from the given URL (platform dependant)
         string st_Path; 
             
         #if UNITY_IPHONE
             st_Path = "file://" + Application.streamingAssetsPath + "/" + AssetName;
         #endif    
                         
         #if UNITY_ANDROID
             st_Path = Application.streamingAssetsPath + "/" + AssetName;
         #endif        
                         
         #if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
             st_Path = "file://" + Application.streamingAssetsPath + "/" + AssetName;
         #endif    
             
         
             //Loads the asset from streaming assets
             WWW www = WWW.LoadFromCacheOrDownload(st_Path,1);
             yield return www;
             AssetBundleRequest request = www.assetBundle.LoadAsync(Asset[0], typeof(GameObject));
             yield return request;
         
             obj((GameObject)request.asset);
             
             //Unload assetbundle and www to clear memory
             www.assetBundle.Unload(false);
             www.Dispose();
         
         
         
 
     }
               Comment
              
 
               
              Yeah, turns out I forgot to add Resources.UnloadUnusedAssets, when I was done with the assetbundle.
Your answer
 
 
             Follow this Question
Related Questions
Unloading asset bundles doesn't clear memory on iOS 1 Answer
How can I store Asset Bundles on a iOS device with the initial download? 3 Answers
Is there a scene count limit for asset bundles? 0 Answers
On-Demand Resource iOS/Android - AssetBundles 1 Answer
how to delete specific files from cache? 3 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                