Search Unity

Constant physical size is not constant on iPhone X

Discussion in 'UGUI & TextMesh Pro' started by joni-giuro, Nov 22, 2018.

  1. joni-giuro

    joni-giuro

    Joined:
    Nov 21, 2013
    Posts:
    435
    Hi, I'm working on a mobile racing game and I'd like to have the UI to scale properly on all devices, it worked properly on the iPad and iPhone 6, then I bought an iPhone X and it's definitely not working like it should.

    IMG_0219.jpg

    IMG_5879.jpg

    The top screenshot is the game running on my iPad, the bottom one is the running on iPhoneX.
    Here are my settings
    Bildschirmfoto 2018-11-22 um 11.39.38.png

    What am I missing?
     
  2. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    you are probably missing that your iPhone has a smaller screen size than the iPad.
    Take a ruler (I mean a real physical one) and measure the controls on the screens. Do they have the same physical size or not? If not, please tell the sizes in millimeters, centimeters or inches (what you prefer).
     
  3. joni-giuro

    joni-giuro

    Joined:
    Nov 21, 2013
    Posts:
    435
    You are right. The screens sizes compared to the ui sizes are so different that it made my brain think that they were actually smaller on the iPad, but they're not. I solved it by changing the scaler to scale with the screen size
     
  4. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    By the way: If you use Better UI (see signature) you could combine physical size and screen size. It is possible to say e.g. scale using screen width (pixel size) by 70% and using dpi (physical size) by 30%. This way you could prevent that the controls are becoming too small (or too big).

    If you wanna do it with Better UI:
    - Select the ResolutionMonitor asset and set the resolution and dpi to your reference screen (e.g. the resolution / dpi of your iPad)
    - add a "Transform Scaler" component to both of your controls (which should have all anchors at the same point) -- Note: In the next version of Better UI there will be a "Size Delta Sizer" Component which is doing resizing without scaling and is therefore preferable.
    - For both controls: Open the "Size Modification" Foldout, add a X- and Y Modification and set them to "Pixel Width" and "Dpi" and adjust the slider for DPI to something like 0.6 (use the same settings for X and Y); you may also adjust the min / max size
     
    Last edited: Nov 22, 2018