Quantcast
Channel: Questions in topic: "assetbundles"
Viewing all articles
Browse latest Browse all 312

Assetbundle memory leaks

$
0
0
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. /// /// Loads asset from Streaming Assets Folder /// /// /// Url to load the asset from /// /// /// A reference to the object that will recieve the loaded asset /// public IEnumerator fromStreamingAssets(string AssetName, System.Action 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(); }

Viewing all articles
Browse latest Browse all 312

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>