x


Dynamically choosing a high resolution texture at runtime on iOS devices

I am developing an iOS game that is designed to run on the iPhone 3GS, iPhone4, and iPad.

Does Unity provide a method to load higher resolution textures for the iPhone4/iPad and lower resolution textures for the 3GS? I'm basically looking for something similar in functionality to the "@2x" feature that Apple's UIKit provides. Ideally, this solution would work for both model textures and UI textures.

I could just use all high resolution textures, but then I would have to worry about the smaller RAM size on the 3GS. So, I'm looking for a more robust solution.

Thanks!

more ▼

asked Sep 29 '10 at 12:26 AM

TimYanalunas gravatar image

TimYanalunas
57 2 2 6

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

For model textures you just have to:

  • enable mip maps on textures
  • configure Quality Settings (Edit->Project Settings->Quality). Make one quality setting to use full res textures and one to use half res textures
  • make a script that gets executed on first game scene startup: check device model there and assign current quality setting according to it.

Sample code:

function Start () {
    if (iPhoneSettings.generation == iPhoneGeneration.iPhone4)
        QualitySettings.currentLevel = QualityLevel.Good; }

For GUI stuff mip maps are not desirable and in this case Resources.Load is your friend.

more ▼

answered Sep 29 '10 at 09:05 AM

Mantas Puida gravatar image

Mantas Puida
871 1 4 10

Thanks, that seems very simple! I'll give it a try.

Sep 29 '10 at 03:56 PM TimYanalunas

I believe that still the highest resolution texture is loaded into RAM though only a specific MipMap Level is processed in the renderer. So still the same RAM usage?!

Jul 14 '11 at 07:44 PM synapsemassage
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2193
x1999
x1952
x378
x360

asked: Sep 29 '10 at 12:26 AM

Seen: 4390 times

Last Updated: Jul 14 '11 at 07:44 PM