How to record current time as a variable

I have a script for blending a scene from a black GUItexture to 0 alpha.
This is the function that blends the scene in

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

Here the ‘StartTime’ is the time the texture fades out and it gets defined here:

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

I want to find a way to define the time where my character dies, He already has an OnTrigger function that calls his death.
I would like to apply this to a scene fade out, so the scene nicely fades out, then fades back in.
Thankyou in advance !

as i understood you, you just need a reference from character that has OnTrigger function to script that draws GUI.

if this script is single (usually it so), you can use FindObjectOfType.

or, you can also make a reference on player creating.

also, SendMessage can be used.

Singleton pattern is also good advanced solution

choose 8)

thankyou !
this is more than enough help :slight_smile: