1
\$\begingroup\$

I'm in the process of optimizing my application memory consumption. To do so, I'm using Unity profiler while connecting to an Android device, which runs a development build of the application.

The application is using two types of sprite containers:

  1. Sprite sheets created by the Texture packer.
  2. Sprite Atlases created by unity.

Using the profiler, it is observed that while the sprite sheets (created by the Texture packer) take the expected amount of RAM, the sprite atlases created by unity consume DOUBLE the expected amount of RAM.

For example, the sprite atlas UIATLAS, whose size is 4096x4096 is supposed to consume 16MB of RAM:

enter image description here

But looking at the profiler, after running "Take Sample", you see the value 32MB:

enter image description here

My sprite atlas settings are:

enter image description here

Any help is welcome here.

One more comment (please review): UIAtlas belongs to an asset bundle called "atlas_ui". It is defined on several directories containing its sprites, all of which belong to the same asset bundle, atlas_ui. Is that the correct way to define it?

Thanks in advance!

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

I'm not 100% certain, but I think your texture setting "Read/Write Enabled" may be the root cause. The texture on the GPU cannot be written to (it can be replaced, but not written to), so a writable copy is kept on the CPU (which also requires memory).

I apologize for a less than certain answer, but it's an easy thing to test and I think it may resolve your issue.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Correct! unchecking Read/Write save me lots of MBs... \$\endgroup\$ Commented Oct 5, 2018 at 18:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .