Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Device Detection Error

Discussion in 'Scripting' started by renman3000, Jan 28, 2017.

  1. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,683
    Hi there,
    I am using this to detect the Device Type that I am using......

    Code (csharp):
    1.  
    2. if(Device == DeviceGeneration.iPhone7Plus){
    3. deviceAsInt = 7;
    4. }

    However, I am getting the error...

    Unsure what to do.???
     
  2. vothka

    vothka

    Joined:
    Mar 27, 2015
    Posts:
    59
    Device is a class so this obviously cannot work - what you are looking is (i think) the static property Device.generation

    Code (csharp):
    1.  
    2. if(Device.generation == DeviceGeneration.iPhone7Plus){
    3. deviceAsInt = 7;
    4. }
    5.  
     
    renman3000 likes this.
  3. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,683
    you are the man!