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

New GUI scaling misunderstanding IOS

Discussion in 'UGUI & TextMesh Pro' started by elpuerco63, Dec 23, 2014.

  1. elpuerco63

    elpuerco63

    Joined:
    Jun 26, 2014
    Posts:
    271
    I am using the new GUI in 4.6 for the first time and am having problems with button sizes appearing differetnly on IOS devices of smaller resolutions.

    On iPads bigger than 1024x768 the buttons appear perfect the same is true on iPhones but on iPad2 at 1024x768 and iPhone4 the buttons appear in the correct position but twice the size?

    Here is my setup:

    Canvas width 805 height 453 (I am unable to amend these as greyed out?)
    Render mode is Screen space overlay
    UI scale mode is constant pixel size
    scale factor is 1
    reference pixels is 100

    Button width 128 height 128

    Button image width 128 height 128
    Texture type is texture
    Max size is 128
    Format is compressed

    Button image on disk is 256 x 256

    I have tried all manner of changes and when I am able to get them to appear right on iPad2 and iPhone4 they appear too small on the newer devices

    totally confusitcated! can any one help please?

    Thanks in advance
     
  2. elpuerco63

    elpuerco63

    Joined:
    Jun 26, 2014
    Posts:
    271
    Help....anyone?
     
  3. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Don't use constant pixel size. Try scale with screen size instead.
     
    elpuerco63 likes this.
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    Yes, I always use the canvas scaler set to scale with screen size. The actual size and reference pixels per unit are kind of arbitrary so I just leave them at the defaults of 800x600 and 100. Use match height, which IMO should be the default; not sure why you'd use width. Then change the sizes of the elements so they look the way you want, and use anchors to position them relative to screen corners or screen center as needed. Make sure text and stuff looks crisp at the highest resolution you are going to use, and it will look good scaled down too. Now the UI will automatically work correctly with any screen size and aspect ratio.

    --Eric
     
    elpuerco63 likes this.
  5. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Absolutely. Forgot to mention that.
     
  6. elpuerco63

    elpuerco63

    Joined:
    Jun 26, 2014
    Posts:
    271
    Thanks guys, I think that has fixed it. The output looks OK in the Game view just need to grab an actual device (during the holidays) to confirm, but looks very promising, will confirm once I get it on a device, thanks again :)
     
  7. elpuerco63

    elpuerco63

    Joined:
    Jun 26, 2014
    Posts:
    271
    Worked a treat, thanks guys :):):)
     
  8. elpuerco63

    elpuerco63

    Joined:
    Jun 26, 2014
    Posts:
    271
    Hi, I have found a small issue and not sure if this is supposed to happen or I'm missing a step?

    In landscape the buttons appear great across the devices but when I rotate to portrait the buttons again increase in size but do remain in place.

    I would though regardless of orientation the buttons would remain the same size?

    Have I missed a crucial step?
     
  9. mog-mog-mog

    mog-mog-mog

    Joined:
    Feb 12, 2014
    Posts:
    266
    In Canvas Scalar,

    play around with Match Value (0-width to 1-height), set it as per you need. You may set it to 0.5
     
    elpuerco63 likes this.
  10. elpuerco63

    elpuerco63

    Joined:
    Jun 26, 2014
    Posts:
    271
    Thank you Lilboylost :)