- Home /
Does UnloadUnusedAssets() unload non-active or occlud
Hello!
Does Resources.UnloadUnusedAssets(); unload assets that are simply non-active and/or occluded? The docs don't mention that specifically, but I'd very much like to know. Thanks!
Answer by iwaldrop · Jun 03, 2014 at 03:08 AM
No, It only unloads assets that have been destroyed. All Unity Object are destroyed via a call to Object.Destroy, passing the Object as an argument. GameObjects are automatically destroyed when unloading a scene unless using doing an additive load. As such, the best time to call it is between scene changes.
That being said, however, I've worked on a project where we had to call it manually due to textures loaded via WWW requests sucking up RAM. To handle it at opportune times, I created a static MemoryReclaimer class which would schedule an UnloadUnusedAssets and a System.GC call after destroying the object.
Your answer
Follow this Question
Related Questions
Resources.UnloadUnusedAssets() doesn't always work. How can I find out why? 0 Answers
Assigning a texture for object in inspector. Is it loaded right away? 0 Answers
Difference between Resources folder Vs normal folder 0 Answers
Resources.load 1 Answer
Does Resouces.UnloadUnusedAssets frees asset bundles unused resources? 0 Answers