Here’s my code, all I want is for the text mesh to fade to black on input, it fade’s out but to grey, not black, I don’t understand it? I even threw in a checker variable isFading. I’ve rewritten this a few times and every time it fades to grey, not black.
Color.Lerp, like other lerp functions, simply interpolates from a source value to a target value given a parameter t between 0.0 - 1.0 so that given 0.0 it will return the first value, given 1.0 it will return the second value, given 0.5 it will return their average, etc.
With that in mind, take a look at this modified script:
Notice that we don’t pass along the current material’s color for the lerp operation, but rather the “beginning” and “end” (or faded out and faded in, in your context) colors. We also use a value t that will always be in the 0.0-1.0 range, modified each frame according to our fade times, and check this value to know if we are done lerping.
Even when the color is set black it goes grey hpjohn. There got to be a simpler way to do it, and I’ve done it this way before, I’ve just never encountered this error before.