my lerp isn't working corectly

hi hoping for some help here

I’m working on some time cycle code

	if ((hoursInt >= keyTime3) && (hoursInt <= keyTime4)) {
			currentDLcolor = DLcolor3;
			currentDLintensity = DLintensity3;
			targetDLcolor = DLcolor4;
			targetDLintensity = DLintensity4;
			timeToNextKey = (keyTime3 - keyTime2) - (((float)hours%24) - keyTime3);
			actualDLintensity = Mathf.Lerp(DLintensity3, DLintensity4, timeToNextKey * Time.deltaTime);
			actualDLcolor = Color.Lerp(DLcolor3, DLcolor4, timeToNextKey * Time.deltaTime);

to lerp the main light colours and intensities between defined key times of day

i got it working when it was simpler now I’ve made it more complex (it works out the time between keys automatically) it just flips to the next value, not sure where i went wrong and can’t remember how i had it before when it was simpler
cheers
Owen

I would start by confirming that you are passing a value between 0 and 1 to your lerp functions:

   float tValue = timeToNextKey * Time.deltaTime;
   Debug.Log("tValue: " + tValue);
   actualDLintensity = Mathf.Lerp(currentDLintensity, targetDLintensity, tValue);
   actualDLcolor = Color.Lerp(currentDLcolor, targetDLcolor, tValue);