public void UpdateAchievement() { OnLeave(); achievementCells = new ArrayList(); achievementCell = Instantiate(Resources.Load("achievementCell")) as GameObject; achievementCell.SetActive(false); Achievement[] a = LoadTxt.GetAllAchievement(); for (int i = 0; i < a.Length; i++) { GameObject o = Instantiate(achievementCell) as GameObject; o.SetActive(true); o.transform.SetParent(ContentA.transform); o.transform.localPosition = Vector3.zero; o.transform.localScale = Vector3.one; achievementCells.Add(o); SetAchievement(o, a [i]); } ContentA.gameObject.GetComponent <RectTransform> ().sizeDelta = new Vector2(900, 110 * achievementCells.Count); }