public void LoadItems() { foreach (Transform child in content.transform) { Destroy(child.gameObject); } parts = DatabaseDataAcces.getCarPartsForUser(player.id); foreach (HasCarPart carItem in parts) { GameObject single = Instantiate(singlePrefab); Transform stars = single.transform.Find("stars"); Transform item = single.transform.Find("item"); Transform attack = single.transform.Find("attackText"); Transform health = single.transform.Find("healthText"); Transform energy = single.transform.Find("energyText"); item.GetComponent <Image>().sprite = GetItemSprite(carItem.carPart.id); if (carItem.stars == 1) { stars.GetComponent <Image>().sprite = oneStar; } else if (carItem.stars == 2) { stars.GetComponent <Image>().sprite = twoStars; } else { stars.GetComponent <Image>().sprite = threeStars; } attack.gameObject.GetComponent <Text>().text = carItem.carPart.power * carItem.stars + ""; health.gameObject.GetComponent <Text>().text = carItem.carPart.health * carItem.stars + ""; energy.gameObject.GetComponent <Text>().text = carItem.carPart.energy * carItem.stars + ""; single.transform.SetParent(content.transform, false); ItemDragHandler dragHandler = item.gameObject.AddComponent <ItemDragHandler>(); dragHandler.hasCarPart = carItem; dragHandler.modifyCar = this; } }