赞
踩
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using System;
- public class ButtonContent : MonoBehaviour{
- public Button btn;
- void Start(){
- btn = GameObject.Find("填写button名").getComponent<Button>(); //-----------(1)
- Text text = btn.transform.Find("Text").getComponent<Text>(); //------------(2)
- //或者吧(1)(2)合并成:
- // Text text = GameObject.Find("填写button名/Text").getComponent<Text>();
- Debug.Log(text.text.toString());
- //其实就一条语句
- // Debug.Log(GameObject.Find("填写button名/Text").getComponent<Text>().text.toString());
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。