Cannot detect iPhone generation- why doesn't this work?

I have been having a heck of a time trying to detect which generation of iPad is being used. I have found many different pages with solutions that must have been deprecated as none of them seem to work.
This is what I have now which compiles OK but doesn’t seem to do anything.
Why doesn’t this work?

 #pragma strict
        var Props_a : GameObject; 
        static var generation: iPhoneGeneration;
        
        function Start () {
        if( generation == iPhoneGeneration.iPad1Gen ){
        		Destroy(Props_a);
        	
        }}

1 Answer

1

iPhoneGeneration is just an enum, you have to look into iPhone.generation to get the generation of the device, so your example would be:

if(iPhone.generation == iPhoneGeneration.iPad1Gen){
       Destroy(Props_a);
}

Thanks mattsonon! …..works perfect!