It is necessary to make an Image in Unity with the property Image Type = Sliced at any screen resolution, square.

Also considered options such as:

  1. Image Type = Simple with Preserve Aspect , but the result did not satisfy me, as the element remains visually square, but for other elements it is rectangular (depending on the screen resolution)

  2. Used some variations with Aspect Ratio Fitter and so on, no results were obtained.

What are the solutions to this problem?

Thanks in advance for any response.

    1 answer 1

    You need to put anchors at one point, and not stretch its corners along the canvas.

    Then the element will not change its shape.

    There is also a way to programmatically check the aspect ratio of the height and width in the update. And podganyat toli height to width (or vice versa) if the wrong ratio.

    • I agree with you. But here there is one moment. If you use different screen resolutions, then the square on them will have a different size. - vmp1r3
    • configure the canvas and you will be zen. - Andrew