Lerp Coroutine Issue

Ok, so im following a tutorial on how to make a pathfinding strategy like game with turns (kinda like Civ). I got through the tutorial, and I was like, im going to make the piece lerp between squares instead of just jumping. Well, I managed to get it to work, but it jumps over tiles since there are two spaces it can move per turn. So, instead of the loop waiting for the lerps to finish, its just updating the final vector the object is supposed to be at, without waiting for the lerp to hit the first. With lerp in update, the lerp worked, but again it missed the first point and went directly to the second. So what I need it to do is wait before moving to the second point. Ive tried using a bool to hold the loop, but that didnt work as Update never got called as it was stuck on my loop (noob mistake I guess). So I decided to use a coroutine, but for some reason its not getting called at all. Heres the code

    public void MoveNextTile()
    {
        float remainingMoves = moveSpeed;
        while (remainingMoves > 0)
        {

            if (currentPath == null)
                return;
            //Get the cost from current tile to next tile
            remainingMoves -= map.CostToEnterTile(currentPath[0].x, currentPath[0].y, currentPath[1].x, currentPath[1].y);

            //Move us to the next tile in the sequence
            toVector = map.TileCoordToWorldCoord(currentPath[1].x, currentPath[1].y);
            Vector3 fromVec = map.TileCoordToWorldCoord(currentPath[0].x, currentPath[0].y);
            MoveObject(fromVec, toVector, 1.0f);
                

            //transform.position = map.TileCoordToWorldCoord(currentPath[1].x, currentPath[1].y);

            //Remove the old current tile
            currentPath.RemoveAt(0);
            this.tileX = currentPath[0].x;
            this.tileY = currentPath[0].y;

            if (currentPath.Count == 1)
            {
                currentPath = null;
            }

            
        }
        
    }
    IEnumerator MoveObject(Vector3 source, Vector3 target, float overTime)
    {
        float startTime = Time.time;
        while (Time.time < startTime + overTime)
        {
            transform.position = Vector3.Lerp(transform.position, target, (Time.time - startTime) / overTime);
            transform.position = target;
            yield return null;
        }
        transform.position = target;
    }

Thank in advance for all the help.

after you’ve fixed @AlwaysSunny’s StartCoroutine, you have to fix this:

transform.position = Vector3.Lerp(transform.position, target, (Time.time - startTime) / overTime);
transform.position = target;
yield return null;

You’re first setting the position to the lerped value, and then setting it to the target directly, overriding the lerp.

Note that what you’re moving will move faster at first if you move it like this:

transform.position = Lerp(transform.position, destination, t);

If you want to move the transform at constant speed, you’ll have to save the start position:

var startPos = transform.position;
while(condition) {
    transform.position = Lerp(startPos, destination, t);    
    yield return null;
}

This is becuase Lerp(a, b, t) gives a value that’s t from a to b. When you do position = Lerp(position, destination, t), you’re moving what you’re lerping from, as well as how far you’re lerping.