And I tried to free the memory of PNG files by appending last bold lines below:
bool assignTextureInst = false;
if (pngTextures.Length > 0) {
assignTextureInst = true;
textureInsts = new Texture2D[pngTextures.Length];
for (int i = 0; i < pngTextures.Length; ++i) {
Texture2D tex = new Texture2D(4, 4, TextureFormat.ARGB32, textureMipMaps);
tex.LoadImage(pngTextures
.bytes);
textureInsts = tex;
tex.filterMode = textureFilterMode;
#if UNITY_EDITOR
tex.hideFlags = HideFlags.DontSave;
#endif
tex.Apply(textureMipMaps, true);
}
#if !UNITY_EDITOR
pngTextures = new TextAsset[0];
#endif
}
It works properly in my case. However, png atlases cost more memory than Unity Texture in XCode debugger, but the wasted memory should be reserved by mono, which is reported in Unity Profiler as well, and I don't think it does matter in my case