How to Unity

A Horizontal (Vertical) Layout Group in Unity is a component used for arranging UI elements horizontally (vertically). It's handy for creating menus and toolbars or keeping UI elements tidy and equally spaced.

None

To use the Horizontal (Vertical) Layout Group, add the component to a gameobject, then place the UI elements inside as children. Let's now go deep into the properties, which apply to both Horizontal Layout Group and Vertical Layout Group

None
None

Padding

The padding is the space between the edges of the layout group and the closest items. It defines an invisible border around the group's layout elements or represents the distance between the first (left, top padding) or last (right, bottom padding) elements and the edges.

A change in the padding will increase or decrease the distance between the edge and the 1st element but not between elements.

None
Changing the left padding
None
Changing the top padding

Spacing

The Spacing is a fixed space between adjacent layout elements. A change in the spacing will increase or decrease the distance between the 1st and the 2nd element but not between the edge and the 1st element.

Child Alignment

Child alignment specifies how the child elements align within the available space: if the elements don't fill out all the space, you can choose alignment options (left, center, right).

Reverse Arrangement

None

This toggle will reverse the order of the children, which by default is the order they have in the hierarchy (sibling index).

None
Original order
None
Reverse order

Control Child Size

If enabled, the layout group controls the width and height of its child layout elements, if disabled, child elements maintain their original size regardless of the layout group size.

Use Child Scale

When enabled, the layout group considers the scale of its child layout elements when sizing and laying out elements. The width and height correspond to the Scale > X and Scale > Y values in each child element's Rect Transform component.

Child Force Expand

Enabling this option forces child layout elements to expand and fill any additional available space. I may cause the children to stretch out.

Grid Layout Group

The Grid Layout Group in Unity is another component for arranging child elements in a uniform grid. Unlike the Horizontal (Vertical) Layout Group, the Grid Layout Group assigns a fixed size to all child elements based on the Cell Size property. Most of its properties are shared with the Horizontal (Vertical) Layout Group, the following are properties specific to this component.

None

Cell Size:

The cell size determines the fixed size of each layout element in the group, ignoring their preferred size.

None

Start Corner:

Specifies the corner where the first element is located.

None
None
None
None

Start Axis:

Determines the primary axis for element placement. With "Horizontal," the grid is filled row-wise, with "Vertical," it is filled column-wise.

Constraint:

Fixes the number of rows or columns.

If you liked the article, please clap to it and share it! Also, take a look at my games!

None

Access my stories and other Medium writers for just $5 a month. With no additional cost to you, I will receive half of your payments as a commission: it's a great way to support me!

CHECK DOWN HERE

Join my newsletter and receive regular notifications when I post.