private void MakeImageCell(Sprite[] sprites) { float cellHeight = (gridLayoutGroup.cellSize.y + gridLayoutGroup.spacing.y) * (sprites.Length / gridLayoutGroup.constraintCount) + gridLayoutGroup.padding.top + gridLayoutGroup.padding.bottom; scrollRect.content.sizeDelta = new Vector2(0, cellHeight); foreach (Sprite sprite in sprites) { ImageCell imageCell = Instantiate(baseImageCell, scrollRect.content).GetComponent <ImageCell>(); imageCell.SetImageCell(sprite, (selectedSprite) => { didSelectImage?.Invoke(selectedSprite); Close(); }); } }