I have an application which build for WebPlayer and WebG. In Application Im load AssetBundle with model and separatly load images for those model from server and when I try to check it from profiler I got strange numbers http://screencast.com/t/uzGs3X8hG
textures which I load have sizes 512x512 and in profiler I see memory usage for this image - 2.7mb.
But if I try to calculate size by hands I got another result:
512x512=262144 pixels
one pixel 32 bit because I set ARGB32 format for loaded texture
262144*4=1048576 bytes
plus mipmaps which generate by unity
256*256*4=262144 bytes
128*128*4= 65536 bytes
64*64*4= 16384 bytes
32*32*4= 4096 bytes
16*16*4=1024 bytes
...(all next mipmap level cost very low)
and if I summ all this numbers I get around 1396736 bytes,
but on screenshot I have 2.7mb why its so huge? What Im doing wrong?
IEnumerator loadObj(WWW www){
yield return www;
if (www.error != null) {
Debug.Log("cant load resource: "+ti.url+" error:"+www.error);
} else {
Texture2D tx=new Texture2D(www.texture.width,www.texture.height,TextureFormat.ARGB32,true);
tx.SetPixels(www.texture.GetPixels());
tx.Apply();
Destroy(www.texture);
transform.GetComponentInChildren().materials[0].SetTexture("_MainTex", tx);
}
www.Dispose ();
}
maybe someone faced to this and know how image use memory
↧