void Start()
        {
            CreateFpsDisplyObj();
            int count = mButtonPanelTf.childCount;

            for (int i = 0; i < count; ++i)
            {
                SceneNameInfo info   = mSceneNameArray[i];
                Button        button = mButtonPanelTf.GetChild(i).GetComponent <Button>();
                button.onClick.AddListener(delegate()
                {
                    SceneManager.LoadScene(info.mSceneName);
                });
                Text text = button.transform.Find("Text").GetComponent <Text>();
                text.text = info.mName;
            }
        }
Exemplo n.º 2
0
        void Start()
        {
            CreateFpsDisplyObj();
            int count      = mButtonPanelTf.childCount;
            int sceneCount = mSceneNameArray.Length;

            for (int i = 0; i < count; ++i)
            {
                if (i >= sceneCount)
                {
                    mButtonPanelTf.GetChild(i).gameObject.SetActive(false);
                    continue;
                }
                mButtonPanelTf.GetChild(i).gameObject.SetActive(true);
                SceneNameInfo info   = mSceneNameArray[i];
                Button        button = mButtonPanelTf.GetChild(i).GetComponent <Button>();
                button.onClick.AddListener(delegate()
                {
                    SceneManager.LoadScene(info.mSceneName);
                });
                Text text = button.transform.Find("Text").GetComponent <Text>();
                text.text = info.mName;
            }
        }