Changing button positions on different resolutions

Hi there,

Is there any solution for the following problem?

I have canvas, with the following parameters:

Render mode: screen space - camera

  • UI Scale Mode: Scale with screen size
  • Ref. resolution: 1280x1920
  • Screen match mode: Match width or height

In this canvas, I have an image where the anchor presets setting is strecth to all the directions (like a background image). The image size is 1280x1920 too, but I think this doesn’t matter…

And there is a button in the canvas too. I set this button’s position to manually based on the image. (There is something on the image, where I want to place the button). The anchor presets setting is middle/center and the position is e.g.: x = 460, y = 730.

And about the problem:

If I changed the screen resolutions, the button’s position stays the same (460/730), but it doesn’t mean the same what was in the original resolution so the button moves away.

I know why that happens. The image and button anchor’s settings are not the same, but I can’t use stretch for the button because in that case, the button will be deformed on other screen resulotions.

Is there any way to solve this issue? E.g.: some matemathical way, to calculate new position to the button; or other settings etc.

I hope what I wrote it’s understandable…

Thanks for your help.

Your button isn’t linked with your canvas so scaling your canvas won’t help, do your best to make sure the button is linked to the canvas.