Hi everybody, I have been looking for a solution for memory usage of downloaded textures, because in one specific UI in my game (2D game) I need to present a lot of images downloaded with WWW, currently I don’t compress them and I receive memory warnings only in that UI. So, what can be the best option for this problem?
make them smaller or don’t target pre 3GS devices which with their 30mb RAM have some serious problems with the overhead of runtime external loaded textures which are 2-3 times as large as the pure byte data.
having them as pvr will not help just to mention that, as pvr can’t be loaded from outside.
This isn’t fully true. You can generate a new Texture2D of format PVRTC_RGB[A][2 or 4] and then via plugin call glCompressedTexImage() with the proper data using the TextureID.
You may also be able to do it 100% in C# via P\Invoke (as most OpenGL calls should be directly P/Invokeable) though I can’t fully test that till tomorrow.
That being said it requires Pro and is both not supported by Unity very well, and somewhat advanced.
To the OP:
You can’t effectively compress on the device due to how long it takes. Make sure when you set the texture, to Apply(false, true) so that the CPU side copy gets cleared to reduce memory somewhat. You can try to reuse the same, textures, unload your textures faster, load less textures, use smaller textures. There are a myriad of solutions, but each one has very specific drawbacks or complexities. Maybe you could elaborate on what you are trying to do.
Me and someone else on my team spent a long time tackling this problem in our game (we were loading/atlassing 100s of textures in at runtime), and ended up going entirely Native Code with it and bypassing Unity to fill in the Textures.
Thats incorrect
On mobile plugins don’t require Pro