Search Unity

How to deal with iPhone X?

Discussion in 'UGUI & TextMesh Pro' started by SkyFire101, Jun 16, 2018.

  1. SkyFire101

    SkyFire101

    Joined:
    Feb 2, 2018
    Posts:
    11
    Hi Guys,

    I´m bit confused about what to do about UI on iPhone X. How do you deal with it?
    Is there a way to show the Status Bar of the phone only when it´s a X, which would be the easiest solution?
     
  2. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    SkyFire101 likes this.
  3. SkyFire101

    SkyFire101

    Joined:
    Feb 2, 2018
    Posts:
    11
    Thanks! Well, it´s not the prime way but it´s a fast solution.
    Got no idea how to do different UIs for different devices, if you or anyone else has a hint on this, I´d be thankful
     
  4. Pelican_7

    Pelican_7

    Joined:
    Nov 25, 2014
    Posts:
    190
    Hey @SkyFire101,

    Adding iPhone X support to my games was mostly just a case of making sure no UI was hidden under the notch. You can use Screen.safeArea to get the visible 'safe' Rect and use this to position your UI. You'll also want to make sure you include the iPhone X splash screen to ensure your game isn't letter-boxed by iOS, but if you're using an up-to-date Unity (I think 2017 and later?), this will be done for you.

    Is there a specific reason that you want to only show the status bar on iPhone X? Usually iOS apps will be consistent across devices as to whether they are full screen or not, but you could have a unique use-case?

    And about different UIs for different devices, you can get pretty far just using the RectTransform's anchors and offsets to make your layout dynamically size. Unity also makes it super easy to test at different resolutions (compared with loading up a separate iOS simulator for every screen size in Xcode).

    Hope that helps!
    -andy.
     
    dythervin and SkyFire101 like this.
  5. SkyFire101

    SkyFire101

    Joined:
    Feb 2, 2018
    Posts:
    11
    Hey @Pelican_7,

    thanks for your answer! The Reason why i asked is cause i tested my game with xcodes simulator on iPhone X and it was horrible :) My Game is in Portrait Mode and has a UI Bar at Top and one at Bottom. Both were heavily affected and unusable as they are. So i need to do anything.

    The idea to have a separate UI for X was cause i don´t wanna have unused Space and a well-arranged UI. Also, whats the sense of a bigger Display if most of the extra Space is just blank? That's why i thought about enabling Status Bar for X. That would keep everything in balance without doing too much lambada.

    Using safe area breaks my visual concept as there´s too much of nothing :)

    I´m really not sure what to do, every option has it´s downsides. As visuals are generally my strength this is hard for me as there´s no way to do it perfectly - just from my point of view of cause.
     
  6. Firemaw

    Firemaw

    Joined:
    Aug 24, 2015
    Posts:
    63