Our app is crashing on mobile devices due to memory issues. We have 2 scenes that we are testing at the moment, scene 0, which has no NGUI elements, and scene 1, which has a large NGUI UI (multiple atlases).
In order to help figure out the problem, We are using a simple script which runs goes back and forth between scene 0 and scene 1, and each time records the results of Object.FindObjectsOfType(typeof(Object)) and Resources.FindObjectsOfTypeAll(typeof(Object)).
We found that when the user goes from scene 1 back to scene 0 (non-additive scene load), while in scene 0 the atlases, atlas materials, and atlas textures are still loaded in memory.
(see
http://docs.unity3d.com/Documentation/ScriptReference/Object.FindObjectsOfType.html and
http://docs.unity3d.com/Documentation/ScriptReference/Resources.FindObjectsOfTypeAll.html )
We've tried manually calling Resources.Unload() on the materials/textures, to no avail.
We do have a couple of scripts we've called DontDestroyOnLoad() on, but they don't have reference to anything but primitive data types, and they don't share a gameObject with any other components.
What can we do to unload these large asset textures from memory?
Thanks.