- Home /
Android and iOS memory usage (Sprite/Texutre2d)
hi there,
i've got some issues with the memory usage of my app on mobile devices.
On android it uses about 150-200 MB, what i think is already to much (apk size 20 mb). And on iOS the RAM explodes, because the app is loading 500+ MB in it before the app crashes.
I think it's caused by the way I use Sprites and Textures in Unity. I've got a lot of Sprite Sheets (2k square, true color) in my project and use many sprites for displaying them on Unity GUI. For that i convert them into Texture2D's at runtime (pixel per pixel operation for each sprite to texture2d at the start of the scene). Is this that bad for the performance and ram usage? Should i use individual texture files instead of Sprite Sheets for GUI?
I would be very happy if someone could tell me a better way do this. And other optimization tips would be also appreciated (especially for iOS).
best regards Dennis
ps. Texture Compression used is ETC1
Edit: I used compressed textures without gradients and seperate graphic files for the GUI instead of creating them at runtime from a sprite. That solved the memory usage issue for me.
Good luck!
Answer by ironblock · Aug 05, 2014 at 07:24 AM
i have several large textures as well but i don't have any problems. but i do have compressed them. sound can also impact the ram and performance. a phone can only decompress one thing at a time.
this helped me for android : http://www.paladinstudios.com/2012/07/30/4-ways-to-increase-performance-of-your-unity-game/
thanks for the link!
I'm only using sounds in wave format in my app. I probably should change that.
What do you think about the Sprite to Texture converting thing im doing? I think it at least doubles the RA$$anonymous$$ usage. Any tips for using sprites on GUI would be nice.