Version: 2023.1
Language : English
Layout Element
Aspect Ratio Fitter

Content Size Fitter

Properties

Property: Function:
Horizontal Fit How the width is controlled.
    Unconstrained Do not drive the width based on the layout element.
    Min Size Drive the width based on the minimum width of the layout element.
    Preferred Size Drive the width based on the preferred width of the layout element.
Vertical Fit How the height is controlled.
    Unconstrained Do not drive the height based on the layout element.
    Min Size Drive the height based on the minimum height of the layout element.
    Preferred Size Drive the height based on the preferred height of the layout element.

Description

The Content Size Fitter functions as a layout controller that controls the size of its own layout element. The size is determined by the minimum or preferred sizes provided by layout element components on the Game Object. Such layout elements can be Image or Text components, layout groups, or a Layout Element component.

It’s worth keeping in mind that when a Rect Transform is resized - whether by a Content Size Fitter or something else - the resizing is around the pivot. This means that the direction of the resizing can be controlled using the pivot.

For example, when the pivot is in the center, the Content Size Fitter will expand the Rect Transform out equally in all directions. And when the pivot is in the upper left corner, the Content Size Fitter will expand the Rect Transform down and to the right.

ContentSizeFitter

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