Timer that can be accessed in multiple scenes

im making a game and have been trying to find a timer script that times you during the main game scene and then displays your time at the end screen that shows up when you lose. I have been looking around and havnt been able to find something that fits what im looking for. can anybody help me out? anything is appreciated.

You can have a static variable to accumulate the time: static variables are created when the program starts, and live while the program is running - even if the script in which the variable is declared is destroyed. The initialization done during declaration only occurs at program start: if you destroy the “owner” object and recreate it after, the variable keeps its last value.

You could do the following:

static var time: float = 0;

function Update(){
  time += Time.deltaTime;
}