您的位置:首页 > 移动开发 > Unity3D

Unity 5.0 无法通过GUIText类型在脚本中调用画布中的Text文字

2015-07-25 10:00 543 查看
原调用方法

修改后的方法:

1:添加命名空间

using UnityEngine.UI;

2:修改参数类型

//UI文字

Text txt_ammo;

Text txt_hiscore;

Text txt_life;

Text txt_score;

3:修改调用方法

//获取设置的UI文字

txt_ammo=this.transform.FindChild("txt_ammo").GetComponent<Text>();

txt_hiscore=this.transform.FindChild("txt_hiscore").GetComponent<Text>();

txt_score=this.transform.FindChild("txt_score").GetComponent<Text>();

txt_life=this.transform.FindChild("txt_life").GetComponent<Text>();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: