using System.Collections.Generic; using UnityEngine; namespace DDD { public class Inventory : MonoBehaviour { Dictionary inventory; private List unusedItems; void Start() { var task= GoogleSheetManager.LoadSo(); var items = task.Result; unusedItems = new List(); // TODO: 데이터에서 가져오기 inventory = new Dictionary(); inventory["0"] = items.ItemList[0]; inventory["1"] = items.ItemList[1]; inventory["2"] = items.ItemList[2]; UpdateItemList(); } public void UpdateItemList() { RectTransform inventoryRoot; RectTransform itemPrefab; var counts = inventoryRoot.childCount; for (int i = 0; i < counts; ++i) { var child = inventoryRoot.GetChild(0); unusedItems.Add(child as RectTransform); child.SetParent(null); child.gameObject.SetActive(false); } foreach (var item in inventory) { } } } }