private void Start() { instance = this; fields = Main.instance.GetAllSettingFields(); Hide(); foreach (Transform transform in submenuContainer.transform) { Destroy(transform.gameObject); } foreach (Submenu s in (Submenu[])Enum.GetValues(typeof(Submenu))) { Instantiate(submenuPrefab, submenuContainer). GetComponent <SubmenuNode>().SetSubmenu(s); } }
private void OnDestroy() { instance = null; }