How can I store data from a timer?

I have coded in a simple timer in my game, and I’d like to grab the number it was last on before you died, and display that. But How would I store the data?

using UnityEngine;
using System.Collections;

public class GUIScript : MonoBehaviour {

float Score = 0;
public float Score_Increase = 6f;

// Use this for initialization
void Update ()
	Score = Score_Increase += Time.deltaTime;
	guiText.text = "Score: "+Score;


Thank you in advance!

Well, assuming you have some “death” code somewhere, say in a separate script for worst case assumption. You just need to inform the script above, GUIScript, when you are dead. Add a method that sets a flag “dead” to true, call that method, and check for (!dead) in the Update method. Something like:

bool dead;

public void onKill()
    dead = true;

void Update()
    if  (!dead)
        Score = Score_Increase ...

Now just call this new method when you reach the death code in your other script. If you don’t have access to this script from there, you can make both the onKill method and the dead variable static.