protected virtual void OnInit() { if (templateRect == null) { if (CacheTransform.childCount > 0) { templateRect = CacheTransform.GetChild(0) as RectTransform; } } if (templateRect != null) { UGUITools.SetVisible(templateRect, false); } if (rowCount < 1) { rowCount = 1; } if (columnCount < 1) { columnCount = 1; } if (!NoScroll) { ScrollRect = UGUITools.SecureComponetInParent <ScrollRect>(CacheRectTransform); } if (ScrollRect != null) { ScrollRect.horizontal = !IsVertical; ScrollRect.vertical = IsVertical; } _Pool = new GNewPrivatePool <LayoutItem>(PoolSize); }