From 5a64abfa80d9500a8420add4efd8546129a8071d Mon Sep 17 00:00:00 2001 From: Rahul Raman Date: Wed, 28 Dec 2016 06:46:38 +0000 Subject: [PATCH] Fixed behaviour when no column width is provided --HG-- branch : develop_5.3 --- Scripts/Layout/TableLayoutGroup.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Scripts/Layout/TableLayoutGroup.cs b/Scripts/Layout/TableLayoutGroup.cs index f6363f4..e1d91ea 100644 --- a/Scripts/Layout/TableLayoutGroup.cs +++ b/Scripts/Layout/TableLayoutGroup.cs @@ -122,9 +122,6 @@ namespace UnityEngine.UI.Extensions public override void CalculateLayoutInputVertical() { - if (columnWidths.Length == 0) - return; - int rowCount = Mathf.CeilToInt(rectChildren.Count / (float)columnWidths.Length); maxPreferredHeightInRows = new float[rowCount]; @@ -183,10 +180,10 @@ namespace UnityEngine.UI.Extensions public override void SetLayoutHorizontal() { - int columnCount = columnWidths.Length; + if (columnWidths.Length == 0) + columnWidths = new float[1] { 0f }; - if (columnCount == 0) - return; + int columnCount = columnWidths.Length; for (int i = 0; i < rectChildren.Count; i++) { @@ -206,8 +203,6 @@ namespace UnityEngine.UI.Extensions public override void SetLayoutVertical() { int columnCount = columnWidths.Length; - if (columnCount == 0) - return; int rowCount = Mathf.CeilToInt(rectChildren.Count / (float)columnCount);