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

Difference between UNITY_IPHONE and UNITY_IOS

Discussion in 'iOS and tvOS' started by simpson45711, Dec 11, 2014.

  1. simpson45711

    simpson45711

    Joined:
    Mar 16, 2013
    Posts:
    18
    I was testing some code on my iphone4s(running IOS 8.1) for the first time using #if UNITY_IPHONE, however it didn't seem to execute. I changed this to UNITY_IOS and it worked..

    Has anyone else experienced something like this and would anyone know the difference between the two?

    Also, I have an android project I am planning to move over for iphones and ipads. It has several plugins which use #if UNITY_IPHONE. Would I need to change each one of these to UNITY_IOS for them to work across all devices?
     
  2. DanielQuick

    DanielQuick

    Joined:
    Dec 31, 2010
    Posts:
    3,137
    For a while I used UNITY_IOS since it made perfect sense to me (iPhone + iPad) however I've been making an effort to switch over to UNITY_IPHONE because it (UNITY_IOS) is not listed anywhere in Unity's Documentation, while UNITY_IPHONE is. I have never noticed a difference between the two.
     
    Last edited: Dec 11, 2014
  3. simpson45711

    simpson45711

    Joined:
    Mar 16, 2013
    Posts:
    18
    Interesting, I thought this was the case as well and UNITY_IOS was just a renamed version which came about later on.
    Not sure why UNITY_IPHONE didn't work in ios8 on my 4s though.
     
  4. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    I'd stick with UNITY_IOS. UNITY_IPHONE doesn't sounds as good because it's applicable to iPad as well.
     
  5. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    The docs for platform defines is here but UNITY_IOS is not even listed.
     
    ruimelo likes this.
  6. cbaltzer

    cbaltzer

    Joined:
    Jan 11, 2012
    Posts:
    120
    The docs are probably a bit outdated, as the engine defines only go up to UNITY_4_5. But, I've always used UNITY_IPHONE. It returns true on iPad as well.
     
  7. Andrey-Postelzhuk

    Andrey-Postelzhuk

    Joined:
    Nov 26, 2013
    Posts:
    75
    Rubly and Ox_ like this.
  8. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    Here's a couple of related bugs I submitted some time ago:

    1. DEVELOPMENT_BUILD is not listed. (#661169)
    2. MonoDevelop does not colour code correctly when using the Global Custom Defines. (#658658)
     
  9. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    I use both to be safe :)

    #if UNITY_IPHONE || UNITY_IOS
     
    GuirieSanchez likes this.
  10. Grespon

    Grespon

    Joined:
    Apr 13, 2012
    Posts:
    388
    UNITY_IOS or UNITY_IPHONE don't seem to work with my iPhone 4S
     
  11. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    Try a Debug statement.