- Home /
Question by
JeremyGames · Aug 02, 2016 at 11:58 AM ·
javascriptscripting problem
Scripting Help: Timer Problem
Hello, I have made a game with a scene that contains a timer, here is the script.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class UITimer : MonoBehaviour
{
public Text timerLabel;
private float time;
void Update()
{
time += Time.deltaTime;
var minutes = time / 60;
var seconds = time % 60;
var fraction = (time * 100) % 100;
timerLabel.text = string.Format("{0:00} : {1:00} : {2:000}", minutes, seconds, fraction);
}
}
I need it so that when the playing loses that level, whatever time you got goes into another scene in a text box and says, "You Failed/Won in x min x sec"! Thanks, Studio 9!
Comment
Your answer
Follow this Question
Related Questions
I need help converting this script from zilch to js 0 Answers
A Proper Way To Pause A Game 9 Answers
Unable to disable a C# script with a JS Script 2 Answers
More Efficient way? 1 Answer