void DisplayList(List <string> ObjectList, string Type) { for (int i = ItemCarrier.transform.childCount - 1; i > 0; i--) { Destroy(ItemCarrier.transform.GetChild(i).gameObject); } if (ObjectList.Count == 0) { ItemCarrier.transform.GetChild(0).gameObject.SetActive(false); return; } CurrentCategory = Type; for (int i = 0; i < ObjectList.Count; i++) { GameObject NewItem; if (i == 0) { NewItem = ItemCarrier.transform.GetChild(0).gameObject; NewItem.SetActive(true); } else { NewItem = GameObject.Instantiate(ItemCarrier.transform.GetChild(0).gameObject, ItemCarrier.transform); } Sprite ItemImage = Resources.Load <Sprite>("GameSystem/InstallableObject/Sprite/" + ObjectList[i]); if (ItemImage != null) { NewItem.transform.GetChild(0).gameObject.GetComponent <Image>().sprite = ItemImage; } else { NewItem.transform.GetChild(0).gameObject.GetComponent <Image>().sprite = ItemImage; // Put NoImagePreview } NewItem.transform.GetChild(1).gameObject.GetComponent <Text>().text = ObjectList[i]; } }