void Show(int num) { if (num < buttonLst.Count) { for (int i = num; i < buttonLst.Count; i++) { buttonLst [i].gameObject.SetActive(false); } } for (int i = 0; i < num; i++) { if (i >= buttonLst.Count) { OptionButton b = GameObject.Instantiate(prefab); b.gameObject.SetActive(true); b.transform.SetParent(prefab.transform.parent); b.transform.localScale = Vector3.one; b.AddListener(i); buttonLst.Add(b); } buttonLst [i].gameObject.SetActive(true); buttonLst [i].SetText(_optionNode.labels[i]); } }