有没有人可以帮忙显示时间
Is there someone who can help for time displaying
我想显示屏幕上显示按钮的时间和用户单击按钮的时间之间的时间,之后我想在下一个场景中显示这两个时间之间的差异
你可以这样做:
private float firstClickTime, secondClickTime;
private float timeDifference;
public void button1_Click(){
firstClickTime=Time.time;
}
public void button2_Click(){
secondClickTime=Time.time;
timeDifference=secondClickTime-firstClickTime; //This give you passed time in seconds
}
之后您可以在任何地方使用 timeDifference 变量。
我想显示屏幕上显示按钮的时间和用户单击按钮的时间之间的时间,之后我想在下一个场景中显示这两个时间之间的差异
你可以这样做:
private float firstClickTime, secondClickTime;
private float timeDifference;
public void button1_Click(){
firstClickTime=Time.time;
}
public void button2_Click(){
secondClickTime=Time.time;
timeDifference=secondClickTime-firstClickTime; //This give you passed time in seconds
}
之后您可以在任何地方使用 timeDifference 变量。