答案 0 :(得分:3)
Here is how I do with landscape images :
RawImage
element called "Mask" (works with UI > Image
component too)UI > Mask
component to itRectTransform
:
Layout > Aspect Ratio Fitter
to the Smurf image and set the Aspect Mode
to "Height Controls Width" and the Aspect Ratio
to the desired value (16/9 for example)Check the image : Parent called "Mask" and your smurf image called "Image"
For portrait images, the RectTransform
values :
The Aspect Mode
of the child must be set to "Width Controls Heigh"