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


修改后的方法:

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>();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值