private GameObject prefab = null; private Transform poolRoot = null; public Text nameTxt { get; private set; } // Use this for initialization void Start () { //GameObject.Find("gameobject_name").SetActive(false/true); GameObject root = GameObject.Find("Version"); //root.transform.gameObject.SetActive(true); this.nameTxt = root.gameObject.transform.FindChild("auth").gameObject.GetComponent<Text>(); //this.nameTxt.gameObject.SetActive(true); } void Update() { GameObject ZoneCon = GameObject.Find("BtnEnterGame"); Button tempBtn = ZoneCon.GetComponent<Button>(); tempBtn.onClick.AddListener(delegate () { OnBtnOnclickMsg(); }); }
以下可以在测试中调式
public void Quit() { #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; #else Application.Quit(); #endif }