public void AddStorage() { if (es.GetMaxNumberOfEnergyStorages() <= 3) { GameObject energyStorageList = Instantiate(storageSprite, new Vector3(300, -69, 0), Quaternion.identity) as GameObject; Image[] storageImage = energyStorageList.GetComponentsInChildren <Image> () as Image[]; energyStorageList.transform.SetParent(GameObject.FindGameObjectWithTag("Canvas").transform, false); storageArray.Add(energyStorageList); } }