Mathf.Lerp

How would i write this to lerp only when check is true, as it is Time.time is executed straight away.

function OnGUI(){
	
if(check){

	GUI.DrawTexture(Rect(Screen.width/2, Screen.height/2, Mathf.Lerp(200, 50, Time.time), Mathf.Lerp(200, 50, Time.time)), MyTexture);
	}
}

You could create your own timer and use Time.deltaTime

var timer;

function OnGUI(){

    if (check == true)
    {
        timer += Time.deltaTime;

        GUI.DrawTexture(Rect(Screen.width/2, Screen.height/2, Mathf.Lerp(200, 50, timer), Mathf.Lerp(200, 50, timer)), MyTexture);
    }
}

Xathereal, thanks, you pointed me in the right direction.

var timer : float;
var startTime : float;
var check : boolean;
var MyTexture : Texture2D;

function Start(){

	startTime = 0; // Set to 0 for Lerp to work, between 0 and 1
}

function Update(){

}

function OnGUI(){

    if (check)
    {
        timer = startTime += Time.deltaTime;

        GUI.DrawTexture(Rect(Screen.width/2, Screen.height/2, Mathf.Lerp(200, 50, timer), Mathf.Lerp(200, 50, timer)), MyTexture);
    }
}