Time.timeSinceLevelLoad 自加载关卡时间
static var timeSinceLevelLoad : float
Description描述
The time this frame has started (Read Only). This is the time in seconds since the last level has been loaded.
此帧开始的时间(只读)。这是以秒计算到最后的关卡已经加载完的时间。也就是说,从最后加载的关卡到现在所用的时间。
C#
JavaScript
using UnityEngine;using System.Collections;public class example : MonoBehaviour {void PlayerCompletedGame() {guiText.text = Time.timeSinceLevelLoad.ToString();}}
// Sets the gui text to the time it took the player to complete the level//设置GUI文本给玩家完成给关卡的时间function PlayerCompletedGame() {guiText.text = Time.timeSinceLevelLoad.ToString();}