Lerp time and movement not in sync

I’m using vector3.Lerp to move from one position to another,but the lerp time and moevement are not in sync as lerp varies from 0 to 1.

Here’s my code

Vector3 Target_Pos=new Vector3(0.18f,0,0);
float LerpTime=0.0f;
float LerpSpeed=10.0f;

void Update()
{
   if(LerpTime<1.0f)
   {
      transform.position=Vector3.Lerp(transform.position,Target_Pos,LerpTime);
      LerpTime=Time.deltatime*LerpSpeed;
   }
   else
   {
      Debug.Log("Lerp is finished");
   }
}

But the object reached at position 0.18f in X before LerpTime reaching 1.0f.The object finished interpolation at a time near 0.05 to 0.1f,but the log will out only when the LerpTime variable reaches 1.0f which is areound 10 to 20 seconds after movement is finished.I need to log the exact time when the object reached its target position

Any help…?

Your LerpTime needs to approach 1f but it stays the same all the time, namely Time.deltaTime*0.18f (just considering the x component). Since deltaTime is almost a constant as well (i.e. 0.02f, the amount it takes to render the last frame).

Change to:

LerpTime += Time.deltaTime;

The transition (Lerp) will then take approx. 1 second. If you would like to speed this up, multiply by a factor, i.e.

LerpTime += Time.deltaTime * 4f;

which makes it 4x as fast, leading to a duration of 0.25 seconds.