unity3d4.6UGUI之后获取UI组件的方法
例子:获取一个TEXT组件
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class SilderText : MonoBehaviour
{
public Slider slider;
Text mytext;
// Update is called once per frame
public void UpdateText ()
{
mytext = gameObject.GetComponent<Text>();
mytext.text = slider.value.ToString();
}
}
在头文件里必须加上using UnityEngine.UI; 这样才能正确的获取的到
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。