,My MoveTowards method is teleporting in Unity. I only want it to move slowly. What do I do?

I am making a game when you gather but my MoveTowards method just teleports the object there or to the position I asked. I have made my own MoveTo method so here are my 3 scripts. One is an IUNit script which is an interface and holds the method MoveTo:

 using System;
using UnityEngine;

public interface IUnit 
{
    void MoveTo(Vector2 position, float stopDistance, Action onArrivedAtPosition);
}

Here is my Unit script which is where the AI goes:

using UnityEngine;

public class Unit: MonoBehaviour, IUnit
{
    public float speed;

    public void MoveTo(Vector2 position, float stopDistance, System.Action arrivedAtPosition)
    {
        if (Vector2.Distance(transform.position, position) >= stopDistance)
        {
            transform.position = Vector2.MoveTowards(transform.position, position, speed * Time.deltaTime);
        }
    }
}

Then my GathererAI which activates my script:

using UnityEngine;

[RequireComponent(typeof(Unit))]
public class GathererAI : MonoBehaviour 
{
public Transform treeNode;
public Transform storageNode;

public IUnit unit;

private void Start()
{
    unit = gameObject.GetComponent<IUnit>();

    unit.MoveTo(treeNode.position, 10f, null);
}
}

But the thing is it just teleports to the position without slowly moving. Please help? Also, how do you start an action?

,I am making a game when you gather but my MoveTowards method just teleports the object there or to the position I asked. I have made my own MoveTo method so here are my 3 scripts. One is an IUNit script which is an interface and holds the method MoveTo:

    using System;
using UnityEngine;

public interface IUnit 
{
    void MoveTo(Vector2 position, float stopDistance, Action onArrivedAtPosition);
}

Here is my Unit script which is where the AI goes:

 using UnityEngine;

public class Unit: MonoBehaviour, IUnit
{
    public float speed;

    public void MoveTo(Vector2 position, float stopDistance, System.Action arrivedAtPosition)
    {
        if (Vector2.Distance(transform.position, position) >= stopDistance)
        {
            transform.position = Vector2.MoveTowards(transform.position, position, speed * Time.deltaTime);
        }
    }
}

Then my GathererAI which activates my script:

using UnityEngine;

[RequireComponent(typeof(Unit))]
public class GathererAI : MonoBehaviour 
{
public Transform treeNode;
public Transform storageNode;

public IUnit unit;

private void Start()
{
    unit = gameObject.GetComponent<IUnit>();

    unit.MoveTo(treeNode.position, 10f, null);
}

}

But the thing is it just teleports to the position without slowly moving. Please help? Also, how do you start an action?

Move towards should be repeated several times until destination is reached, not just firing it once. You can do it in update method or in a coroutine for example. Inside your “iteration” method you can also have an exit condition, for example to check if your transform has arrived to the destination. The exact behaviour of MoveTowards is well described in unity documentation Unity - Scripting API: Vector3.MoveTowards