using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class UserChooseScene : MonoBehaviour { public GameObject cs; public GameObject st; public UserChooseSceneItem item; List list = new List(); // Start is called before the first frame update void Start() { initList(); } public void initList() { Debug.Log("µ±Ç°³¡¾°===¡·" + UserSceneManager.Instance.SceneList.Count) ; foreach(var i in UserSceneManager.Instance.SceneList.Values) { UserChooseSceneItem go = GameObject.Instantiate(item, item.transform.parent); go.gameObject.SetActive(true); go.itemName.text = i.name; go.id = i.id; list.Add(go); } list[0].tg.isOn = true; } public void gotoScene() { cs.SetActive(false); st.SetActive(true); for (int i = 0; i < list.Count; i++) { if(list[i].tg.isOn) { GameScene.Instance.gotoScenes(list[i].id); break; } } } }