Unity3D: automagic texture quality adapting for iDevices

March 29, 2011 in Unity3D

How to adjust texture quality or size or resolution according to different iDevices

adjust texture quality or size or resolution according to different iDevices

How to adjust texture quality or size or resolution according to different iDevices (iPod, Iphone, iPad etc.) automatically?
You can adjust this via the quality settings (Project settings > Quality) in Unity3D. It’s important that you use Mip Maps in the texture import settings!!! Import the best texture (max. 2048×2048), this will be used for the newest/best devices. Quality settings and Mip Maps will automatically downgrade your textures according to the older/slower devices depending on what you set in the quality settings in the editor.
Use this code somewhere during initialisation

1
2
3
4
5
6
7
8
9
10
11
function Awake(){
if( iPhoneSettings.generation == iPhoneGeneration.iPhone ) 
{ 
QualitySettings.currentLevel = QualityLevel.Fastest;
} 
else if( iPhoneSettings.generation == iPhoneGeneration.iPhone3GS ) 
{ 
QualitySettings.currentLevel = QualityLevel.Fast;
}
else if( iPhoneSettings.generation == iPhoneGeneration.iPhone4G )
{ and so on …}}