public void CreateCards() { GameObject cardInstance = null; UICard script = null; for (int i = 0; i < CARD_TOTALCOUNT; i++) { cardInstance = Instantiate(cardPrefab, Vector3.zero, Quaternion.identity); script = cardInstance.GetComponent <UICard>(); script.Draw(faces[i], back, i); script.transform.SetParent(this.transform); cardInstance.SetActive(false); cards[i] = script; } }