private void FillSoldierElementIconPool(uint value) { if (soldierIconPool == null) { soldierIconPool = new List <Image>(); } for (int i = 0; i < value; i++) { //When finished the prefab id, use id. GameObject temp = GameObject.Instantiate(resourceLoad.LoadAsset <GameObject>("Soldier")); temp.SetActive(false); soldierElementCount++; temp.name = string.Format("SoldierElementIcon{0}", soldierElementCount); temp.transform.SetParent(elementIconParent, false); soldierIconPool.Add(temp.GetComponent <Image>()); } }