Android to iOS UI problems

Hi,
I have my app working perfect under Android with the canvases set to reference resolution 1920 x 1080 and all works well.

I have now switched to iOS and am finding that dependant on which resolution I choose they either fit correct or are completely out of whack!

I have tried changing the reference resolution to 2688 x 1242 and some look ok but when I change to others they are still out of whack?

My problems are:

  1. If I start fiddling with all the UI settings it will mean I have to have two project versions one for Android and one for iOS, surely that is not right?

  2. If I try to set my reference resolution to an iPad the iPhones are out and vice versa, how do others handle this, have I missed somthing?

Thanks…in hope

So is your problem related to automatic positioning of UI elements when you use anchors etc. or that you UI doesn’t respect the aspect ratio of the display?

@piginhat

Which Canvas Scaler UI Scale Mode you are using?

Hi,

Canvas Render Mode: Screen Space Overlay
Canvas Scalar: Scale with screen size
Reference Resolution: 1920 x 1080
Match width or height: 0.5

These settings seem to respect all the supplied editor Android resolutions, but editor iOS they UI elements start to drift

Its the position of the UI elements.

I’ve done a lot of UI set and have not had much issue before switching targets where the UI respect each platform.

This is the first time I have found major problems.

Using Unity 2018.3.3.f1

@piginhat

One thing that comes to mind, is have you tried to create the resolution you will use on the target device in editor?

What I mean, go to your Game View, open the dropdown that shows aspect ratio or resolution, press + and create a pixel resolution that matches your target device.

Then you would see if it’s your anchoring and RectTransform setup issue or something else.

Yes, I already have done that.

What I am finding on further scrutiny is for the most part the UI is holding good, apart from when selecting any of the iPad aspect ratios, all others are OK, which does not happen on Android when changing target aspect ratio.

I will continue to fiddle and let you know what occurs

@piginhat

Well if this happens in editor, then it’s your RectTransform, anchors and Canvas setup.

Aspect ratio might not reveal all problems, remember presets can also adjust actual pixel resolution instead.

When the pixel resolution doubles (for example) you could have problems if your Canvas is setup certain way.

Thanks guys, looks like some of my anchors were out which oddly did not seem to upset Android whereas they did iOS.

Good learning curve…check…check…then check again!