Material lerp problem

Hello,

I have this script to fae from one material to another, but it doesn’t work. nay help?

Also, how I make this to happen once, when I press a key?

Time.time will be the time since the app started, so if Time.time is greater than 2.0 when ‘dry’ becomes ‘true’, then nothing will happen with this code. As a quick test, you can change your code to:

var lerp = (Time.time % duration) / duration;

But the real fix will like be some sort of timer that you can start and reset:

timer += Time.deltaTime;
var lerp = timer  / duration;