- Home /
Question by
EvilMonkeyPaw · Dec 17, 2013 at 04:23 AM ·
colorfunction updateambient lightrendersettingscolor.lerp
Color.Lerp does not seem to update for any apparent reason, any ideas?
I'm trying to lerp the color of my scene's ambient light from black to some color (I haven't decided what yet). for testing, I tried to get it to lerp to yellow, but it seems as if the Lerp function is only called once and never called again and I have no idea why. Here's my code, any help would be much appreciated.
var startColor : Color = Color.black;
var changeColor : Color = Color.black;
var endColor : Color;
var lerpedColor : Color;
var changeTime : float = 5.0;
function Start () {
startColor = RenderSettings.ambientLight;
endColor = RenderSettings.ambientLight;
lerpedColor = startColor;
}
function Update () {
lerpedColor = Color.Lerp(startColor, endColor, changeTime * Time.deltaTime);
RenderSettings.ambientLight = lerpedColor;
}
function OnTriggerEnter (other : Collider) {
endColor = changeColor;
}
function OnTriggerExit (other : Collider) {
endColor = startColor;
}
Comment
Answer by EvilMonkeyPaw · Dec 17, 2013 at 04:49 AM
Nevermind, I figured out what I did wrong, I was resetting lerpedColor every time the update function ran through.
Your answer
Follow this Question
Related Questions
Color.Lerp doesn't go until white. Why? 2 Answers
Mixing Colors Using Fractions 1 Answer
Material doesn't have a color property '_Color' 4 Answers
Why are the UI Textures darkening when Built? 1 Answer
Ambient light not reflecting right 0 Answers