- Home /
Question by
richardzzzarnold · Nov 13, 2013 at 01:53 PM ·
generationdetectiphonegeneration
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);
}}
Comment
Best Answer
Answer by mattssonon · Nov 13, 2013 at 02:09 PM
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);
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613121809im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
how one would go about using Triangulator in javascript? 0 Answers
Procedural terrain generation ? 0 Answers
Dyanmic Platforms and Erasing Geometry? 0 Answers
Randomly Generated map 0 Answers
This code crashes unity, please help! 0 Answers