I use this to measure how much of memory a texture occupies:
Profiler.GetRuntimeMemorySize(cachedTexture)
I create a texture like this:
cachedTexture = new Texture2D(2, 2);
cachedTexture.LoadImage(contentData);
So pretty simple. Then I print in Update method the memory usage. Right after LoadImage my texture is 18 MBs in memory. But in the next frame, in Update method, it is around 40 MBs. And that is the number the profiler measures. Where does that come from?
try cachedTexture.mipmapCount and see if there is a mip chain. It can be that the extra 30 mb are the mip chain.
That would be weird. A texture that weighs x MBs without mipmaps, weights 4/3*x with mipmaps. So the numbers don’t really add up.
Another interesting observation. I used Compress method to compress the texture. And now GetRuntimeMemorySize returns 30 MBs all the time, but when I take a memory snapshot in the profiler I can clearly see that this particular texture weighs 3 MBs in memory (to be more precise: 3 MBs when found in the Inspector window, but 30 MBs in the profiler’s snapshot textures list). That’s a huge difference.