Version: 2020.1
Content Size Fitter
Horizontal Layout Group

Aspect Ratio Fitter

Properties

Property: Function:
Aspect Mode How the rectangle is resized to enforce the aspect ratio.
        None Do not make the rect fit the aspect ratio.
        Width Controls Height The height is automatically adjusted based on the width.
        Height Controls Width The width is automatically adjusted based on the height.
        Fit In Parent The width, height, position, and anchors are automatically adjusted to make the rect fit inside the rect of the parent while keeping the aspect ratio. The may be some space inside the parent rect which is not covered by this rect.
        Envelope Parent The width, height, position, and anchors are automatically adjusted to make the rect cover the entire area of the parent while keeping the aspect ratio. This rect may extend further out than the parent rect.
Aspect RatioThe relationship of an image’s proportional dimensions, such as its width and height.
See in Glossary
The aspect ratio to enforce. This is the width divided by the height.

Description

The Aspect Ratio Fitter functions as a layout controller that controls the size of its own layout element. It can adjust the height to fit the width or vice versa, or it can make the element fit inside its parent or envelope its parent. The Aspect Ratio Fitter does not take layout information into account such as minimum size and preferred size.

It’s worth keeping in mind that when a Rect Transform is resized - whether by an Aspect Ratio Fitter or something else - the resizing is around the pivot. This means that the pivot can be used to control the alignment of the rectangle. For example, a pivot placed at the top center will make the rectangle grow evenly to both sides, and only grow downwards while the top edge remain at its position.

Content Size Fitter
Horizontal Layout Group
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961