Mathf.Lerp not working

With this script I am unable to get the “speed” var to pass 1.05. I am unsure why this is happening?

public float speed;

void Update ()
    {
        speed = Mathf.Lerp(1f, 8f, 0.5f * Time.deltaTime);
    {

Could someone clarify he reason? I have used Mathf.Lerp before and never got this effect before. I know the lerp slows down when it gets closer to the end var, but it s off by so much.

Lerp works fine (it’s a very basic math function), but the way you’re attempting to use it is wrong. Lerp stands for Linear Interpolation, where the function interpolates from one number to the next, where you normally have the third parameter advance from 0.0 to 1.0. If we assume Time.deltaTime is probably around 0.017 (60fps), then 0.5 * Time.deltaTime means 0.5 * 0.017 or 0.0085. So Lerp (1, 8, 0.0085) returns 1.0595 always, with some minor variation depending on the exact framerate.

The correct way to use Lerp is to not use Time.deltaTime in the third parameter; aside from the above, it makes your code framerate-dependent due to math which I won’t get into here. The easiest way to use Lerp correctly is inside a coroutine (not Update):

var t = 0.0f;
while (t <= 1.0f) {
	t += 0.5 * Time.deltaTime;
	speed = Mathf.Lerp(1f, 8f, t);
	yield return null;
}

Maybe you should try with this

 public float speed;

 void Update ()
     {
         speed = Mathf.Lerp(speed, 8f, 0.5f * Time.deltaTime);
     {

Guys, I just found a solution for this. when you assign the result of this (Mathf.Lerp(a,b,t)) you shouldn’t do it to a new variable. for example If I want to set “k” to “M” by "t’ in every frame using Mathf.Lerp. This is what I’d do -
float K = 10;
float M = 30;

float t = 0.2f;

Update()
{
      Lerp();
}

void Lerp()
{
      K = Mathf.Lerp(K ,M, t * Time.deltaTime)`
      float m = K;
      Debug.Log(m);
}`

What happens is, I set the value returned by Mathf.Lerp to K which is the value I want to interpolate
to ITSELF. By this way, in every frame K is updated. If you assign this returned value to a new variable, this K will stay same forever and will give the same value every time you run the code as it is not changing withing the Mathf.Lerp method. this method does not change it’s arguments..
But, by assigning the returned value of the method to itself K is UPDATED EVERY FRAME. then you won’t stuck in the same value every time you run your code. If you want this K value for another variable, assign it just after the method. (I’ve done it as a comment) Debug.Log is the way how I took output here.