To add a new TableLayout object, right-click the desired location in the hierarchy window, and select
UI -> TableLayout -> Add New Table.
You will then be presented with the following wizard:
This will allow you to select how many rows and columns the new table should have by default. You can always add/remove rows and columns later if you wish.
</AddingANewTableLayout>
Specifies the padding around the entire Table.
Specifies the image to use as the background for each row.
Specifies the color to use for each rows background image.
Specifies the image to use as the background for each cell.
Specifies the color to use for each cells background image.
If this is set, then the TableLayout will automatically add entries to Column Widths if any row has more cells than there are entries in Column Widths.
Essentially, this allows you to have TableLayout automatically handle column widths in the same manner as an HTML table.
If this is set, the TableLayout will automatically remove entries from Column Widths if there are columns specified in Column Widths which have no cells in them.
Specifies the width of columns in the table. To have a column automatically sized by TableLayout, specify its width as 0.
If this is set to true, then the Cell Padding value specified for this TableLayout will be applied to all of its cells.
The padding value to use for each cell in this TableLayout if Use Global Cell Padding is set.
Specifies how much space to leave between cells.
If this is set, the TableLayout will automatically set its own height. This is only useable if each row within the TableLayout has a preferred height set.
This will add a new Row with a full set of empty cells (using the number of entries in Column Widths to determine how many cells to add).
This will add a new Row with no cells.
This will add a new row which is a copy of the last row in the table.
</TheTableLayoutComponent>
Sets the height of this row. If the value is 0, then the height of this row will automatically be calculated by the TableLayout.
If this is set, then you can override the default row background image and color for this row (by modifying the Image component). If it is not set, then TableLayout will override any values set with its own.
</TheTablerowComponent>
Cells store the actual contents of your layout.
How many columns should this Cell span?
If this is set, then you can override the default cell background image and color for this cell (by modifying the Image component). If it is not set, then TableLayout will override any values set with its own.
If the TableLayout is set to use Global Cell Padding, setting this value will allow you to override that Global Cell Padding for this cell.
Sets the padding for this cell.
</TheTablecellComponent>
AddRow
method. If no argument is specified, then this method will add a new row with a full set of empty cells (as per Column Widths). Alternatively, you can specify a number of cells you wish to add.
TableRow newRow = tableLayout.AddRow();
newRow.preferredHeight = 128;
Rows
property, e.g.
TableRow firstRow = tableLayout.Rows[0];
tableLayout.CalculateLayoutInputHorizontal();
</TableLayout>
AddCell
method. You can optionally specify content for the cell by providing a RectTransform as an argument.
TableCell newCell = tableRow.AddCell();
newCell.columnSpan = 2;
Cells
property, e.g.
TableCell firstCell = tableRow.Cells[0];
</Tablerow>
</Tablecell>