There is an image in the game, atlas, 2048 to 2048, RGBA.

When compressed in RGBA Crunched ETC2, its size is only 0.6 MB

But in the process of RAM profiling, it is clear that it takes much more there! In the editor, it takes 16 megabytes, which can be explained by the fact that ETC2 is a compression format for android, and on the PC it is unpacked into a regular RGBA 32 bit.

But the problem is that on an Android device its memory size is 4 MB! Yes, it is 4 times less than the RAM on the PC, but it is still much more than the declared 0.6 MB

What can be the case, and how to reap the textures for the android to match the size stated in the editor?

    1 answer 1

    You are a little wrong interpretation of the concept of compression.

    The official Unity blog has an article explaining Crunched compression. The main feature of these types of compression is that the texture takes up less space on the disk space. But in order to be used when rendering it is unpacked. Unpacking occurs just at the moment of loading into RAM. As described in the article, when unpacking a Crunched compression, we get a DTX texture in memory that will weigh more than the original compressed texture. This compression format is very convenient if you need to reduce the size of the application package, or downloadable content, such as bundles).

    If you want to save a lot on the size of the textures in the RAM, you can resort to a couple of fairly complex tricks that will work on textures with a high alpha content.

    1. Splitting the alpha channel of the picture into a separate texture. In this case, under the alpha, you can select a smaller texture (there will not be much artifacting) and moreover, since this texture only has to store information about channel 1, and the type of texture can be used RGB - you can push alpha of different images on all three channels in one image, thereby fitting 3 alpha atlas to one. It will be possible to draw all this only through a custom shader, and in general, the idea is rather complicated to implement.
    2. Few people notice that Unity draws sprites on the screen using WireFrames. That is, for drawing the image, not a square consisting of 2 triangles-polygons is used, but a grid cropped in alpha. This can be played when packing textures in atlases. That is, collect the textures in the atlas, on their grid, ignoring the alpha channel. Something similar was implemented in Playrix and called them Polygonal Atlases . And in Unity this can be done either by hand, or use one of the plug-ins, for example this one . You can read more about this idea here in Russian and here in English . From myself I can add that this approach works best for isometric art.