I have a lerp system that changes the background color of the world to represent different times of day, but when I hit play the sky goes completely black, what did I do wrong?
#pragma strict
public var myCamera : Camera;
public var colorTime : float = 0;
public var turnTime = 0; /* 0 for day 1 for night */
var lerpedColor : Color = Color.cyan;
public var dayC : Color;
public var nightC : Color;
function Update() {
lerpedColor = Color.Lerp(dayC, nightC, Mathf.PingPong(Time.time, colorTime));
myCamera.backgroundColor = lerpedColor;
}
for DayC and nightC I went into the components and edited the color there, but the color still remains black when i hit play.
EDIT:
Here’s a pic of the problem with the component
I am not sure why lerped color changes to black and gets that odd long white line
If you look at the scripting reference entry, you’ll see that it will return a value between 0 and the second parameter. In this case, since you are getting a value to use in a Lerp, you want a value between 0 and one. This means that the second parameter should be 1.
The same way you change the colors, there are 4 slides. Red, Green, Blue, and Alpha