When you add an image of .png format in unity weighing approximately 9 KB, the same image in unity weighs 1 MB. Explain why. enter image description here

  • What is your evidence? Are there screenshots or something else? - Alexey Shimansky
  • @ Alexey Shimansky Added Screen - Shadr

1 answer 1

You are a little confused. Unity does not increase anything.

The fact that the properties of the image - the physical size of the disk. And what is displayed in Unity (bottom right) is the size of the picture in memory .

In your case, the following is obtained:

501 x 501 x 4 bytes (32 bits) = 251 001 x 4 bytes = 1 004 004 bytes = ~0.957 MB = ~1.0MB 

With size - everything.

If you want to optimize consumption and reduce the size of the texture in memory, you can play with the settings, such as Format or MaxSize, or even select Advanced in the TextureType settings and customize it.


PS Try not to make images whose sides have an odd value. The parties should be a multiple of 2, for example 100x200 or 256x512 , and generally the recommendation, especially for mobile platforms, is to insert pictures into the texture of a power of two (Power of 2), for example 256x256 or 512x512 , etc. Link: https://docs.unity3d.com/ru/530/Manual/class-TextureImporter.html , item "Texture sizes"

  • Thank you for the clarification. And what's wrong with odd sizes, why not? - Shadr
  • one
    @Shadr is an extensive topic and much can be said. If the quote "NPOT (not a multiple of two) usually uses a little more memory, it can be read more slowly by the GPU, for performance it’s better to use the size of the power of two everywhere you can. If the platform or the graphics processor does not support NPOT size textures, then Unity will change them sizes to the nearest equal degree of two, which will require even more memory and will make loading slower ".......... it is also impossible to apply some types of compression to them ...... - Alexey Shimansky
  • @Shadr and with non-square textures (even if divided by 2, but not a power of two) there may be problems on mobile platforms in general .. there is generally desirable to do them as a POT .... further ... in a square atlas there may be sprites with odd dimensions, however, this may affect for example when plotting a scene where sprites may simply disagree with each other and have breaks ... You can do something like a GUI, but in general you shouldn’t - Alex Shimansky