protected void ReturnObjectToPool(RectTransform rect) { CellBase cell = rect.GetComponent <CellBase>(); cell.ClearCell(); resourceManager.ReturnObjectToPool(rect.gameObject); }
///<summary> ///Create a cell from object pool and initialize it with the corresponding data from <see cref="dataSource"> ///</summary> protected RectTransform InitializeCellFromPool(int i) { GameObject obj = resourceManager.GetObjectFromPool(hierarchy[i].prefabName); CellBase cell = obj.GetComponent <CellBase>(); cell.hierarchyData = hierarchy[i]; cell.hierarchyData.isFullyLoaded = false; cell.scrollRect = this; cell.SetCellData(dataSource[i]); RectTransform rect = obj.GetComponent <RectTransform>(); rect.SetParent(content, false); SetTopAnchor(rect); return(rect); }