Color.Lerp does not update

I’m working on a day/night cycle script, and I’m totally done except for the Color.Lerp

when 1 day/night cycle is set to 1 minute, the speed of the Color.Lerp is 0.004 it takes like 2-4 seconds
when cycle is set to 2 minutes color lerp is set to 0.002 (50%, with is good!)
but when i set the cycle to more than 10 minutes Color.Lerp isn’t really slow but it just doesn’t work

is this because unity cuts floats with more than 3 characters behind the comma

some code (Thats bassicly how i do it)

var CycleInMinutes = 12;
var Day : Color;
private var CurrentSkyColor : Color;

function Update () {
     skycolor.camera.backgroundColor = CurrentSkyColor;
     CurrentSkyColor = Color.Lerp(CurrentSkyColor,Day,Time.deltaTime * 0.004 / CycleInMinutes);
}

Your math is broken, not Color.Lerp.

With a solid framerate, this will be constant. Let’s say it’s 1/2 just for simplicity.

Time.deltaTime * 0.004 / CycleInMinutes

We’ll also say CurrentSkyColor is black and Day is white. Here’s what a value in CurrentSkyColor will be at

Start: 0

Update 1: .5

Update 2: .75

Update 3: .875

Your variable naming could also use work.

Lerp (Color, Vector2, Vector3, etc) does something like this:

function Lerp (a, b, t) {
  t = Mathf.Clamp01 (t);
  return a * (1 - t) + b * t;
}

You are passing a very low value for t (running at 100 FPS and with CycleInMinutes = 10 the value would be 0.000004) so Lerp is always returning a value close to a. In fact if t is low enough it would return a due to rounding errors.

You should use fixed values for both a and b and do the math to span from 0 to 1 withing the specified time.

CurrentSkyColor = Color.Lerp(StarColor, Day, Time.time / (CycleInMinutes * 60.0));