- Home /
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!
How did you solve this? For 2D games, this is a very apparent issue.
Answer by Mantas-Puida · Sep 29, 2010 at 09:05 AM
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.
I believe that still the highest resolution texture is loaded into RA$$anonymous$$ though only a specific $$anonymous$$ip$$anonymous$$ap Level is processed in the renderer. So still the same RA$$anonymous$$ usage?!
Sorry to be late to the party but is there (STILL) no other way to load 2D assets that are right for each screen resolution than Resources.Load? This should clearly be the job of Unity.