0

We're having this weird problem with a game we're porting to mobile: All UI elements work fine, except when you run it on a phone with notches (iPhoneX for instance). When that happens the interface gets rescaled to fit the device's safe area, which creates two black bars on the extremes (which is ok for now). Then, the area in which you have to click to activate any buttons doesn't correspond to the button graphics themselves anymore.

It's as if the input detection area is stretched to cover the entire area of the phone, but the graphics are scaled down, "dislocating" the input touch areas.

The picture below shows the problem:

Picture showing the problem

Notice the red scribbles showing the area that's outside the safe areas, and the green circle showing where the input for the button actually went.

Additional info: for the levels to work properly we have to force the resolution to 1080 using Screen.SetResolution(). Could this have anything to do with the problem?

Eduardo Z.
  • 633
  • 3
  • 10
  • 32
  • Can you post a screenshot of the inspector, displaying the RectTransform settings (anchor etc.) Along with a hierarchy image – Immorality Mar 28 '19 at 22:08
  • Do you have a CanvasScaler on this, or are are you doing something more complex from code? It could be that whatever you're doing in your code is interfering with Unity's UI system. – Marconius Mar 29 '19 at 09:33
  • @Immorality sure thing... https://imgur.com/a/F8ysuH5 – Eduardo Z. Mar 29 '19 at 16:36

0 Answers0