Denis Vasilyev Denis Vasilyev - 1 year ago 63
iOS Question

What's the best way to use big textures (2048*1536) in Unity3d with NGUI on ios?

I'm using Unity3d (4.3.1) and NGUI for creating an 2d iOS (iPad) app. Also I need to use a lot of full screen images (about 100 images with size 2048x1536), for Gallery for example.
Now I'm using them with GUI type, override for iPhone with max size 2048 and compression quality: normal. And I'm using a

UITexture
with Unlit/Transparent shader to show them.

However, after about 40 images in the project XCode returns the
terminated due to memory
error. So the question is, what type of images do I need, and with which preferences to make them work?

I'm using iPad 3 as a test device with XCode 5.1.1. I'll be thankful for any help!

Answer Source

Also I need to use a lot of full screen images (about 100 images with size 2048x1536), for Gallery for example.

I think your 2048x2048 size images use a very huge memory area. Basically, 2048 image use 16MB memory. So, this case need to use about a 1600MB memory! Normal application don't over about 200 MB.

So, I think you need to be reduce using a memory:

  1. Remember that this texture is going to be expand 2048x2048 by unity.( http://www.opengl.org/wiki/NPOT_Texture ) So, if you are going to reduce file size to 1500x1000, your application still use 2048x2048 image. But if you can reduce file size to 1024x1024, do it. 1024 image just use 4 MB memory.

  2. If you can use texture compression. Use it. PVRTC 4 bit ( https://docs.unity3d.com/Documentation/Manual/ReducingFilesize.html ) compression is make file size 1/8 than true color. Also memory size is going to reduce.(maybe reduced to half)

  3. If your application don't display all images, load image dynamically. Use thumb nail.

Good luck:D

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download