Is there a variable that you can set to see how long you’r playing the current scene? I would realy like to make like a guilabel in the left corner of my screen saying how long the player is already playing.
Ty!
if im correct:
- Time.Time is loaded with the app.
- Time.timeSinceLevelLoad is loaded
since the level is loaded.
You just need to have a variable that increments itself each second. Here’s a very simple script. First go to GameObject>CreateOther>GUIText
.
Drag this script into an empty game object and add the GUIText that you created into the timeDisplay variable in the inspector window
var playedTime : float;
var timeDisplay : GUIText;
function Start(){
playedTime = 0.0;
}
function Update(){
playedTime += Time.deltaTime;
timeDisplay.text = Mathf.RoundToInt(playedTime).ToString();
}
This script should work, tried already. I Hope this helped
-Vatsal