public void LoadInventory(int index) { Inventory inventory = Inventory.Instance; InventoryData inventoryData = saveData.GameDatas[index].InventoryData; foreach (BagData bagData in inventoryData.BagDatas) { Bag bag = Instantiate(inventory.bagItemPrefab, inventory.transform).GetComponent <Bag>(); bag.ItemSetting = GetItemFromDataBase(bagData.Name); bag = GetBagFromBagData(bag, bagData); inventory.AddBag(bag, inventory.BagButtons[bagData.Index]); } }