Quantcast
Channel: Questions in topic: "unloadunusedassets"
Viewing all articles
Browse latest Browse all 85

using UnloadUnusedAssets() to remove www.texture from memory cause freezing

$
0
0
I have a coroutine loading textures from a folder. When loading a new texture I need to unload the other textures from memory(I think I have read all the threads on this issue), the only thing that seem to work is UnloadUnusedAssets(). However it freezes unity. What can I do? Is it better to use UnloadAsset()? but I dont know what to feed that function with to clear the unused textures. public IEnumerator setDecalTexture() { www = new WWW("file:///"+decalTextureFiles[selectedDecal].FullName); yield return www; CarBodyRenderers= this.gameObject.GetComponentsInChildren(); foreach(Renderer rend in CarBodyRenderers){ if(rend!=null){ foreach(Material matt in rend.materials){ if(matt.name == decalMaterialName|| matt.name == decalMaterialName+" (Instance)"|| matt.name == decalMaterialName+" (Instance) (Instance)"){ if(www!=null&& decalMaterialName!= null && www.isDone==true)matt.mainTexture=www.textureNonReadable; } } } } //www.Dispose(); //www = null; //System.GC.Collect(); Resources.UnloadUnusedAssets(); currentDecal=selectedDecal; Debug.Log("setDecalTexture()"); } ![alt text][1] [1]: /storage/temp/79852-unloadassetsfreeze.png

Viewing all articles
Browse latest Browse all 85

Trending Articles



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