List<Item> list;
int count = list.Count;
for (int i = 0; i < count; i++)
{
Item it = list[i];
if (inventory.transform.GetChild(1).childCount >= i)
{
GameObject img = Instantiate(container);
img.transform.SetParent(inventory.transform.GetChild(1).GetChild(i).transform);
img.GetComponent<Image>().sprite = Resources.Load<Sprite>(it.sprite);
img.GetComponent<Drag>().item = it;
}
else break;
}