Horizontal, Vertical, and Grid Layout Groups

Tyler Smallwood
3 min readSep 27, 2023

--

Objective: Cover Layout groups a little more.

There are three layout groups in Unity. There is Horizontal, Vertical, and Grid. Horizontal and vertical are very similar. The only difference is one layout is across the x axis while the other is along the y axis.

Horizontal Layout Group

In the component we have padding, spacing, child alignment, reverse arrangement, control child size, use child scale, and child force expand.

By default child force expand is already select. This will expand the images out based on the layout group.

While use Child Scale will keep the native size of each image.

If we were to use Control Child Size, we can see the images change size if we adjust the rect of the layout group.

Child Alignment will start the images from what ever is select. There are a few different options.

Spacing will space out the images from each other.

Padding will pad the images from the edge of the layout group’s rect.

I did this one with horizontal, vertical layout group is the exact thing except up and down.

Grid Layout group is different. We still have padding but we don’t have the same type of spacing. Grid has Cell Size, Spacing for both x and y axis, start corner, start axis, child alignment and constraints.

Cell size will adjust the size of the images. You can’t change the size without adjusting the Cell size. The biggest thing for this is we can adjust how we want to grid out the images. We can do max 3 columns or rows, once there is three columns or rows it’ll adjust to add another column or row depending what is set to have a constraint.

Having the Constraint to Fixed Column Count and the count is two, we will get two columns and three rows.

Changed to 5 Columns we get more columns and some more rows with more images.

Same look but for fixed rows.

A quick little overview on layout groups!

Thanks for reading! Have a wonderful day!

--

--

Tyler Smallwood
Tyler Smallwood

Written by Tyler Smallwood

I am passonate on learning to program and use Unity to become a skillful Unity Developer

No responses yet