unity5.1 UILabel报错
用C#在unity里做计时器,UILabel报错了,新版本不知道如何解决....usingUnityEngine;usingSystem.Collections;usin...
用C#在unity里做计时器,UILabel报错了,新版本不知道如何解决....
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class CountDown : MonoBehaviour {
public UILabel countDown;
public int endTime;
public int currentTime;
public int startTime;
public int second;
public int minute;
private string printTime;
private string stringEndTime;
void Start () {
startTime = 300;
}
void Update () {
endTime = startTime - currentTime;
second = endTime % 60;
minute = endTime / 60;
currentTime = Mathf.CeilToInt(Time.fixedTime);
if(second<10){
printTime = ":0";
}else{
printTime = ":";
}
stringEndTime = "00:0" + minute + printTime + second;
print(stringEndTime);
countDown.text = stringEndTime;
if(endTime<0){
endTime = 0;
}
}
顺便上面的代码是从网上摘的.. 展开
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class CountDown : MonoBehaviour {
public UILabel countDown;
public int endTime;
public int currentTime;
public int startTime;
public int second;
public int minute;
private string printTime;
private string stringEndTime;
void Start () {
startTime = 300;
}
void Update () {
endTime = startTime - currentTime;
second = endTime % 60;
minute = endTime / 60;
currentTime = Mathf.CeilToInt(Time.fixedTime);
if(second<10){
printTime = ":0";
}else{
printTime = ":";
}
stringEndTime = "00:0" + minute + printTime + second;
print(stringEndTime);
countDown.text = stringEndTime;
if(endTime<0){
endTime = 0;
}
}
顺便上面的代码是从网上摘的.. 展开
2015-07-18
展开全部
inputnameLabel类型inputnameLabel场景绑定哪控件
其实直接inputnameLabel声明UILabel类型场景UIlabel控件绑定代码直接写inputnameLabel.text行
我记UILabel像能做输入直接用Input控件!
其实直接inputnameLabel声明UILabel类型场景UIlabel控件绑定代码直接写inputnameLabel.text行
我记UILabel像能做输入直接用Input控件!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询