# Unity3D: Mathf Lerp too fast when timescale increases

I have an image with a fill amount component controlled by a Mathf Lerp. The problem is, the time for completion of the Mathf Lerp function decreases more than expected when the timescale increases.

When the timescale is equal to 2 the function should take half the time to complete but it takes less than that. Any idea why?

public static float demolishTime = 6.0f

public void OnClickDemolish()
{
InvokeRepeating("demolishProgress", 0f, 0.1f);
}

void demolishProgress()
{
progress += (Time.deltaTime / demolishTime);
demolishProgressBar[DemolishManager.demolishState].fillAmount = (float)Mathf.Lerp(0, 1, progress);
if (progress >= 1) demolishCompleted();
}


When you have a coroutine scheduled with InvokeRepeating, then the repetition frequency is affected by the current timescale. That means the delta-time adjustment in a InvokeRepeating routine is not necessary.
• @ClaudioA You did: progress += (Time.deltaTime / demolishTime);. Simply change that to 0.1f / demolishTime. The 0.1f is the InvokeRepeating factor. Sep 29 '19 at 16:45