Game Development Reference
In-Depth Information
Again, we have the familiar Rect Transform to set the Grid's layout area and the
same Padding options as the other layout groups.
The rest of the options open up some new possibilities for how children of the
grid should be arranged; all these settings will determine how many cells will
appear within the Rect Transform of the grid and how they are laid out.
They are elaborated here:
Cell Size : This defines the interior cell size of child elements; this will
also resize the content to the defined size unless overridden by the Layout
Element component (see Layout Element section later in this chapter). The
control will automatically try to fit as many child elements within its grid
based on the cell size and the size of the group Rect Transform . If the grid
cannot it a new cell in, then it won't attempt to. (A fine balance to work out
from how big you want your cells to the size of the group itself.)
Spacing : As with the other layout groups, you can define spacing in-between
child elements; the main difference with the Grid contents is that you can set
separate spacing for both vertical ( Y ) and horizontal ( X ) children.
Start Corner : A nice little effect sets which is the first cell within the grid that
children are drawn from (the start point). You can choose from any of the
four corners of the grid, defined as Upper Left , Upper Right , Lower Left , and
Lower Right . (No, you cannot start in the middle! That would just be silly.)
Start Axis : Along with the Start Corner , you can also define the flow for
the cells by drawing in a horizontal direction first (starting from the Start
Corner ) or you can draw in the vertical direction first. If we set the Start
Corner to Upper Left the child controls would flow in the following order:
Child Alignment : If the child elements have been configured with a Layout
Element (later in the chapter) component, then you can align them within the
grid cells around any of the edges or the middle.
 
Search WWH ::




Custom Search