Hello people, as the tittle indicate , i’m trying to increment a int value from value A to a value B in a N amount of seconds ,

void Update() 
	{
	
		
		if (bDiveDelay)
		{
			
		    iPlayerSpeed = Mathf.MoveTowards (fDiveMagnitude, iSpeedInter, 5 * Time.deltaTime);
			print ("speed es " +iPlayerSpeed);
		}
		
		if (iPlayerSpeed == iSpeedInter)
			{
		
			bDiveDelay = false;	
			}

}

i’m trying to increment my iPlayerSpeed from the value fDiveMagnitude to iSpeedInter in a certain amount of time , but it doesnt work , it start adding numbers to the value but it never reaches the value of iSpeedInter , I also tried thi with mathf.Lerp, and got same result. Any help/ comment will be really appreciated, thanks for your time

you should do something like

playerspeed = mathf.lerp(playerspeed,desiredspeed, speed * time.deltatime);

basically the first value should be the same as what your changing

if the first value is constant your speed won’t change.