Class HorizontalOrVerticalLayoutGroup
Abstract base class for HorizontalLayoutGroup and VerticalLayoutGroup to generalize common functionality.
Inheritance
Inherited Members
Namespace: UnityEngine.UI
Assembly: UnityEngine.UI.dll
Syntax
[ExecuteAlways]
public abstract class HorizontalOrVerticalLayoutGroup : LayoutGroup, ILayoutElement, ILayoutGroup, ILayoutController
Fields
m_ChildControlHeight
Declaration
[SerializeField]
protected bool m_ChildControlHeight
Field Value
Type | Description |
---|---|
bool |
m_ChildControlWidth
Declaration
[SerializeField]
protected bool m_ChildControlWidth
Field Value
Type | Description |
---|---|
bool |
m_ChildForceExpandHeight
Declaration
[SerializeField]
protected bool m_ChildForceExpandHeight
Field Value
Type | Description |
---|---|
bool |
m_ChildForceExpandWidth
Declaration
[SerializeField]
protected bool m_ChildForceExpandWidth
Field Value
Type | Description |
---|---|
bool |
m_ChildScaleHeight
Declaration
[SerializeField]
protected bool m_ChildScaleHeight
Field Value
Type | Description |
---|---|
bool |
m_ChildScaleWidth
Declaration
[SerializeField]
protected bool m_ChildScaleWidth
Field Value
Type | Description |
---|---|
bool |
m_ReverseArrangement
Declaration
[SerializeField]
protected bool m_ReverseArrangement
Field Value
Type | Description |
---|---|
bool |
m_Spacing
Declaration
[SerializeField]
protected float m_Spacing
Field Value
Type | Description |
---|---|
float |
Properties
childControlHeight
Returns true if the Layout Group controls the heights of its children. Returns false if children control their own heights.
Declaration
public bool childControlHeight { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
If set to false, the layout group will only affect the positions of the children while leaving the heights untouched. The heights of the children can be set via the respective RectTransforms in this case.
If set to true, the heights of the children are automatically driven by the layout group according to their respective minimum, preferred, and flexible heights. This is useful if the heights of the children should change depending on how much space is available.In this case the height of each child cannot be set manually in the RectTransform, but the minimum, preferred and flexible height for each child can be controlled by adding a LayoutElement component to it.
childControlWidth
Returns true if the Layout Group controls the widths of its children. Returns false if children control their own widths.
Declaration
public bool childControlWidth { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
If set to false, the layout group will only affect the positions of the children while leaving the widths untouched. The widths of the children can be set via the respective RectTransforms in this case.
If set to true, the widths of the children are automatically driven by the layout group according to their respective minimum, preferred, and flexible widths. This is useful if the widths of the children should change depending on how much space is available.In this case the width of each child cannot be set manually in the RectTransform, but the minimum, preferred and flexible width for each child can be controlled by adding a LayoutElement component to it.
childForceExpandHeight
Whether to force the children to expand to fill additional available vertical space.
Declaration
public bool childForceExpandHeight { get; set; }
Property Value
Type | Description |
---|---|
bool |
childForceExpandWidth
Whether to force the children to expand to fill additional available horizontal space.
Declaration
public bool childForceExpandWidth { get; set; }
Property Value
Type | Description |
---|---|
bool |
childScaleHeight
Whether to use the y scale of each child when calculating its height.
Declaration
public bool childScaleHeight { get; set; }
Property Value
Type | Description |
---|---|
bool |
childScaleWidth
Whether to use the x scale of each child when calculating its width.
Declaration
public bool childScaleWidth { get; set; }
Property Value
Type | Description |
---|---|
bool |
reverseArrangement
Whether the order of children objects should be sorted in reverse.
Declaration
public bool reverseArrangement { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
If False the first child object will be positioned first. If True the last child object will be positioned first.
spacing
The spacing to use between layout elements in the layout group.
Declaration
public float spacing { get; set; }
Property Value
Type | Description |
---|---|
float |
Methods
CalcAlongAxis(int, bool)
Calculate the layout element properties for this layout element along the given axis.
Declaration
protected void CalcAlongAxis(int axis, bool isVertical)
Parameters
Type | Name | Description |
---|---|---|
int | axis | The axis to calculate for. 0 is horizontal and 1 is vertical. |
bool | isVertical | Is this group a vertical group? |
Reset()
Declaration
protected override void Reset()
Overrides
SetChildrenAlongAxis(int, bool)
Set the positions and sizes of the child layout elements for the given axis.
Declaration
protected void SetChildrenAlongAxis(int axis, bool isVertical)
Parameters
Type | Name | Description |
---|---|---|
int | axis | The axis to handle. 0 is horizontal and 1 is vertical. |
bool | isVertical | Is this group a vertical group? |
Update()
Declaration
protected virtual void Update()