using System.Collections; using System.Collections.Generic; using UnityEngine; public class MainCenterManager : MonoBehaviour { public static MainCenterManager Instance; public List list; private void Awake() { Instance = this; list = new List(); int ct = this.transform.childCount; for (int i = 0; i < ct; i++) { list.Add(this.transform.GetChild(i).gameObject); } } private void OnEnable() { showMain(); } public void show() { for (int i = 0; i < list.Count; i++) { if(list[i].activeSelf) list[i].SetActive(false); } } public void showMain() { MainCenterManager.Instance.show(); list[0].SetActive(true); } }