Record current time to use as a variable

I need to record the current time of when my character dies to use it as a variable to fade out a scene.
I already have the code to fade a scene, this:

GUI.color.a = Mathf.Lerp(1.5, 0.0, (Time.time-StartTime));

here the time is defined by ‘StartTime’ which is called here:

function OnLevelWasLoaded(){
// Store the current time
StartTime = Time.time;

I want to find a way to define another time "DeathTime’ perhaps, which can be used as a time variable to fade out the scene.
Thankyou in advance !!

var deathTime : float;

As a rule of thumb, variables should begin with a lowercase letter and functions / classes should begin with a capital letter - this isn’t necessary or anything, it’s just convention so that anyone looking at the code can instantly see that “Oh, that’s a variable!” or “Oh, look, a function!” It’s helpful for you later when you come back to your own code, too :wink: