The TextureUtil contains such useful functionality, please make it public.
Methods such as GetStorageMemorySizeLong, GetRuntimeMemorySizeLong, GetTextureFormat and GetTextureFormatString are so crucial to have when writing custom editor tools, yet they are inaccessible to us.
In pretty much every project I end up in reflection hell, just to get access to things like mentioned above. I would be able to write more robust editor tools if the TextureUtils class is accessible.
Agreed, just looking into this myself as there appears to be no runtime or even good editor method to get a textures memory requirements.
Edit:
For anyone interested in accessing this api I stumbled upon a nice gist here.
Certainly saved me time trying to dig into reflection again.
I guess there are no official methods for calculating projected memory usage for a specific texture ( e.g. creating a RenderTexture of some format ). So i’ve been writing my own and comparing the results to Unity’s which I would assume just looks at the actual size of the data.
There is definitely some weird things with say anti-aliasing using more memory than I expected. From Unity’s numbers it looks like there is an additional pixelCount * bytesPerPixel at mipmap level 0 on top of what you would normally expect. Other gotchas are compressed formats not going down to exactly 1 pixel for final mipmap level and for 3D volumes depth isn’t mipmaped which is understandable but has got me thinking how that might affect volumetric data at mipmapped levels.
Anyway, regardless would still be nice to get the Unity size for a texture in the editor as that is useful information in of itself.