I do have atlas leak in my current project.
so all the Atlases are inside memory after its loaded.
i have scene specific atlases so a given scene have specific Altus.
I found few references initial search and clean up. but still i can find the atlases are not getting release soon after scene been unloaded.
now what I'm tying is force to unload texture from UI atlas material. Its worked and now i can not see the atlus texture in memory but that makes a UISprites and other UIWidget derived object gray or white. but if i deactivate and enable(from inspector) they are getting refreshed.
so can some one help me here.
Unload texture by,
UnityEngine
.Object[] Objs1
= Resources
.FindObjectsOfTypeAll(typeof(UIAtlas
));List
<UIAtlas
> totalAtluses
= new List
<UIAtlas
>();foreach(UnityEngine.Object tempObject in Objs1)
{
UIAtlas atlus = tempObject as UIAtlas;
Resources.UnloadAsset(atlus.spriteMaterial.mainTexture);
}
Reload textures By,
Object loadedAtlusTexture
= Resources
.LoadAssetAtPath("/Atlases/"+atlusName,
typeof(Texture2D
)); atlusObject.spriteMaterial.mainTexture = (Texture2D)loadedAtlusTexture;
atl.MarkAsDirty();
I do have latest NGUI