Hi Guys.
I think that NGui Widget are serializing a directly reference to the atlas texture that cause Unity3d load in memory the unused HD texture.
I added in UIWidget:
// Awake
Debug.Log(gameObject ": " (mMat == null ? "no material": mMat.name));
Debug.Log(gameObject ": " (mTex == null ? "no texture": mTex.name));
// Start
Debug.Log("START: " gameObject ": " (mMat == null ? "no material": mMat.name));
Debug.Log("START: " gameObject ": " (mTex == null ? "no texture": mTex.name));
And receive these logs in editor:
FadingSprite (UnityEngine.GameObject): no material
FadingSprite (UnityEngine.GameObject): MenuAtlasHd
START: FadingSprite (UnityEngine.GameObject): MenuAtlasSD
START: FadingSprite (UnityEngine.GameObject): MenuAtlasSD
I was debug why some HD textures from atlas/font are being loading in memory. Showed by Resources.FindObjectsOfTypeAll(typeof(Texture). These texture are being loaded even if I delete the AtlasHD.prefab or AtlasHD.mat.
Some considerations:
- this test I execute in Editor
- I using classic solution for multiples atlas resolution in same build: AtlasRef, AtlasHd, AtlasSD.
- AtlasRef have replacement and material cleared before build.
- AtlasRef is pointed from AtlasHD/SD loaded from resource at first scene.
- Every widget is pointing to AtlasRef
- Some time in the past I think that some widgets pointed directly to HD version (could be cached that time?)
- many of theses widgets are stored in prefabs
NGUI master, could you give a look if it really could happens? Or can give me a direction for what I probably is doing wrong?
-- Added
In editor if I select the atlas texture and use contextual menu "Find References in Scene", the unity select the widgets where Awake show HD texture.