Iphone generation

i am REALLY to stupid to understand the manual.

Can someone please explain with some lines of code how to find out on which type of device the script runs?

Try this:

if( iPhoneSettings.generation == iPhoneGeneration.iPhone )
{
    //Its a first generation iPhone
}
else if( iPhoneSettings.generation == iPhoneGeneration.iPhone3G )
{
    //Its a second generation iPhone
}
else if( iPhoneSettings.generation == iPhoneGeneration.iPhone3GS )
{
    //Its a third generation iPhone
}
else if( iPhoneSettings.generation == iPhoneGeneration.iPodTouch1Gen )
{
    //Its an iPod Touch, first generation
}
else if( iPhoneSettings.generation == iPhoneGeneration.iPodTouch2Gen )
{
    //Its an iPod Touch, second generation
}
else if( iPhoneSettings.generation == iPhoneGeneration.iPodTouch3Gen )
{
    //Its an iPod Touch, third generation
}
else
{
    //Unknown device or are you in the editor?
}

Hope it helps…

thank you! worked fine.

Glad it helps. :stuck_out_tongue:
Cheers.

how do you tell the difference between touch 3rd gen 8gb (actually second gen. hardware) and 32gb (3rd gen. hardware) ?
is there a get total device memory check or something ? or a get device name ?

When getting the iPhoneSettings.generation, Unity doesn’t check for the firmware, it’s checking the hardware. This means even if you’re running 3.0 on a 2nd gen device, Unity wil tell you that it’s a 2nd gen device.

I don’t believe there is a way to get the different memory capacity types though.

You don’t need to get the disk space etc for that.
The 8GB itouch 2nd gen that was sold along the iTouch 3GS is correctly recognized as being a 2nd generation itouch, it does not “stealth” itself as a 3GS device, no worries there.

and if you wanted to check it you would never use disk space. instead you would ask it if it supports openGL ES 2.0. YES → 3GS or newer, NO → first or second gen :slight_smile:

I tried this solution and it didn’t work for me. I think it is because of the new version of Unity (3.5.5f3)

This is what works with this version of Unity:

if(iPhone.generation == iPhoneGeneration.iPodTouch3Gen)
{
	print ("iPodTouch3G detected!");
}

Just change iPhoneSettings for iPhone. :slight_smile:

Hi,

Is All iPod Generations have same Display resolution or Different ? Can you Confirm me ? Thank you In Advance.

There are 3 resolutions used in iPod touches, 480x320 (you can neglect this, since these devices only support iOS 5.1.1 or lower), 960x640 and 1136x640.