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. Dismiss Notice

Detect iPhone 5C from Unity 4.2

Discussion in 'iOS and tvOS' started by protopop, Jul 22, 2014.

  1. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,545
    Hi everyone,

    I need to detect if my game is running on an iPhone 5C but the enum (is that the right word?) hasn't been added to Unity 4.2.2. Unfortunately i need to stick with version 4.2 because of the IOS terrain regression from Unity 4.3 onwards, and I use terrain trees.

    Does anyone have an idea how it might be possible? Or just because the iPhoneGeneration.iPhone5C wasnt added to 4.2 if i just add the line in " if( iPhoneSettings.generation == iPhoneGeneration.iPhone5C )..." will it still work anyways?
    Thank you
     
  2. SpiriTx

    SpiriTx

    Graphics QA Unity Technologies

    Joined:
    Apr 12, 2012
    Posts:
    252
    Do you need to exactly know if it's 5c?
    On 4.2.2 you should get iPhoneUnknown for 5c and 5s, so you could know that's one of new devices based on that.

    Btw, what terrain regression do you have in mind? I'd check on the status of that.
     
  3. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,545
    Thanks SpiriTx:)

    re: Terrain regression - IOS terrain trees introduced unplayable slowdown since version 4.3 (4.2 works perfectly). There's a thread here: http://forum.unity3d.com/threads/max-mesh-trees-setting-broken.224212/ and a bug report here: http://issuetracker.unity3d.com/issues/terrain-tree-culling-performance-regression - it happened after Unity rewrote its culling engine in version 4.3

    I want to detect iPhone 5C because I just launched an open-world wilderness game on iPhone (https://itunes.apple.com/us/app/id885657108?mt=8) and when i run it on an iPhone 5 or 5C as opposed to an iPhone 5S i disable water refraction to smooth the frame rate. I can detect the 5 but i don't have a way to detect the 5C and disable refraction on that device.

    I thought about using iPhoneUnknown but if i disable refraction on unknown devices it would disable it on iPhone 5S too because that device is not in Unity 4.2 either, so i can't target it specifically to make sure refraction isnt disabled.

    I really appreciate the advice and I'm going to have to continue to look for workarounds until/if it gets fixed.
     
  4. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Does 4.2 have .../Classes/Unity/DeviceSettings.mm:QueryDeviceGeneration()? That's where the model is looked up. You may be able to hack some code in there. Maybe add some data to .../Classes/iPhone_Common.h.
     
    protopop likes this.
  5. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,545
    That query device thing sounds promising. I'm going to take a closer look and see if I can find something like that. You're right - it probably gets the name of the device even if that particular profile isn't available. Thanks for the clever advice:)