I Have a Gui in my game that keeps track of the amount of time the player stays alive (Kind of Like their score). When the player dies I want the Time to be paused so the Game Over screen will have that number displayed. Then when they Restart the game, the time must be reset.
`void Update ()
{
timeText.text = "" + Time.time;
if (gameOver) {
timeText.text = "" + Time.realtimeSinceStartup;
}
if(restart)
{
if (Input.GetKeyDown (KeyCode.R))
{
Application.LoadLevel (Application.loadedLevel);
}
}`
if (gameOver) {
timeText.text = “” + Time.realtimeSinceStartup;
}
This snippet of code did not work how I wanted it to