Skip to main content

Class SpaceBetweenLayoutGroup

A "Space-between" layout group position its items evenly within the alignment container along the main axis. The spacing between each pair of adjacent items is the same. The first item is flush with the main-start edge, and the last item is flush with the main-end edge. It has the option to placed its child layout element to either next to each other, or on top of each other.

[AddComponentMenu("Layout/Space Between Layout Group", 154)]
public class SpaceBetweenLayoutGroup : LayoutGroup

Inheritance​

Fields​

m_LayoutAxis​

Whether to arrange its layout horikzontally or vertically.

[Tooltip("")]
[SerializeField]
protected SpaceBetweenLayoutGroup.LayoutAxis m_LayoutAxis

Field Value​

SpaceBetweenLayoutGroup.LayoutAxis

m_ReverseArrangement​

Whether the order of children objects should be sorted in reverse.

[Tooltip("Whether the order of children objects should be sorted in reverse.")]
[SerializeField]
protected bool m_ReverseArrangement

Field Value​

bool

Remarks​

If False the first child object will be positioned first. If True the last child object will be positioned first.

Properties​

ReverseArrangement​

Get/set whether the order of children objects should be sorted in reverse.

public bool ReverseArrangement { get; set; }

Property Value​

bool

Remarks​

If False the first child object will be positioned first. If True the last child object will be positioned first.

layoutAxis​

Get/set whether to arrange its layout horikzontally or vertically.

public SpaceBetweenLayoutGroup.LayoutAxis layoutAxis { get; set; }

Property Value​

SpaceBetweenLayoutGroup.LayoutAxis

Methods​

CalcAlongAxis(int)​

Calculate the layout element properties for this layout element along the given axis.

protected void CalcAlongAxis(int axis)

Parameters​

NameTypeDescription
axisintThe axis to calculate for. 0 is horizontal and 1 is vertical.

CalculateLayoutInputHorizontal()​

public override void CalculateLayoutInputHorizontal()

CalculateLayoutInputVertical()​

public override void CalculateLayoutInputVertical()

OnValidate()​

protected override void OnValidate()

SetChildrenAlongAxis(int)​

Set the positions and sizes of the child layout elements for the given axis.

protected void SetChildrenAlongAxis(int axis)

Parameters​

NameTypeDescription
axisintThe axis to handle. 0 is horizontal and 1 is vertical.

SetLayoutHorizontal()​

public override void SetLayoutHorizontal()

SetLayoutVertical()​

public override void SetLayoutVertical()
  • Fields
    • m_LayoutAxis
    • m_ReverseArrangement
  • Properties
    • ReverseArrangement
    • layoutAxis
  • Methods
    • CalcAlongAxis(int)
    • CalculateLayoutInputHorizontal()
    • CalculateLayoutInputVertical()
    • OnValidate()
    • SetChildrenAlongAxis(int)
    • SetLayoutHorizontal()
    • SetLayoutVertical()