Scale an object over time without Lerp

i need to scale an object from “a” scale to “b” scale.
I just dont need the smooth scaling that Lerp has.

@nicocabal02 I wrote a solution that you can apply by using Coroutine for the question by taking the path too long. You can eliminate smoothing completely by playing with the variables. In the update() method, you can also solve the problem by calling the processes in the coroutine separately. I made a different suggestion below the sample script.

private const float Tolerance = 0.01f;
private const float UpdateInterval = 0.05f;

private void Start()
{
    StartCoroutine(ScaleAtoB(transform, Vector3.one, new Vector3(0f, 2f, 1f), .25f));
}

private IEnumerator ScaleAtoB(Transform t, Vector3 initialScale, Vector3 finalScale, float incrementalSpeed, bool setInitialScale = true)
{
    if (setInitialScale)
    {
        t.localScale = initialScale;
    }
   
    var localScale = t.localScale;
    float xIncrement = GetIncrementOverTime(localScale.x, finalScale.x) * incrementalSpeed;
    float yIncrement = GetIncrementOverTime(localScale.y, finalScale.y) * incrementalSpeed;
    float zIncrement = GetIncrementOverTime(localScale.z, finalScale.z) * incrementalSpeed;

    localScale = new Vector3(localScale.x + xIncrement, localScale.y + yIncrement, localScale.z + zIncrement);
    t.localScale = localScale;

    yield return new WaitForSeconds(UpdateInterval);
    
    if (Mathf.Abs(localScale.x - finalScale.x) > Tolerance ||
           Mathf.Abs(localScale.y - finalScale.y) > Tolerance ||
           Mathf.Abs(localScale.z - finalScale.z) > Tolerance)
    {
        yield return StartCoroutine(ScaleAtoB(t, initialScale, finalScale, incrementalSpeed, false));
    }
}

private static float GetIncrementOverTime(float localAxis, float finalAxis)
{
    if (localAxis > finalAxis) return -1 * Time.deltaTime;
    return Time.deltaTime;
}

I suggest you DOTween since there is no indication about using asset in the problem. You can find exactly what you need by looking through its documentation. To give two very simple examples:

//DOTween - https://assetstore.unity.com/packages/tools/animation/dotween-hotween-v2-27676
 
//DOTween Solution - 1
public void ScaleAtoB(Transform t, Vector3 initialScale, Vector3 finalScale, float time)
{
    t.localScale = initialScale;
    t.DOScale(finalScale, time);
}

//DOTween Solution - 2
public void ScaleAtoB(Transform t, Vector3 initialScale, Vector3 finalScale, float time)
{
    t.localScale = initialScale;
    DOTween.To(() => t.localScale, x => t.localScale = x, finalScale, time);
}