|
I'm loading AudioClips and Texture2D from Resources a lot. Do I need to Destroy() them when I no longer need them? Is it the same thing to set the variable holding them to null? Or how do I make sure everything is destroyed when I no longer need it?
(comments are locked)
|
|
And the correct answer is: You need to call Resources.UnloadUnusedAssets() or assets loaded from resources will stay in memory FOREVER! There should really be a huge red warning-box on all the documentation-pages about Resources stating this! :) I absolutely agree. I had to be told by Unity's support staff about this in a reply to a bug report before I got it. Unity's memory management is really something that needs to be documented better.
Dec 13 '11 at 10:03 AM
CHPedersen
Wow! this helped me amazingly! i put this in the AppController in applicationDidReceiveMemoryWarning and used a UnitySendMessage to dealloc memory, saved my app! i used a lot of textures, loaded as WWW that (strangely) never got cleared up thank you!
Mar 25 at 11:11 AM
vanss2
(comments are locked)
|
|
Hi, Check this Answer because Resources.UnloadUnusedAssets() wasn't really doing the job for me on level loading.
(comments are locked)
|

This may help http://answers.unity3d.com/questions/7768/memory-management-and-c-dos-and-donts.html