Assigning positions to the path

When I assign new positions to the path, after it finishes calculating, it adds 30 more positions, and the points it adds are weird. Does someone know why?

The path the supposed to be

the actual path after calculation

The Code
[SerializeField] Vector3[] points;
public event Action FinishedCaculatePath;
[SerializeField] Seeker seeker;
public void CalculatePath(Vector3[] points)
{
// Create a new path instance
Path path = ABPath.Construct(transform.position, points[points.Length - 1], finishedCaculatePath);

    // Add intermediate target positions to the path

    NNConstraint constraint = NNConstraint.Default;
    for (int i = 0; i < points.Length - 1; i++)
    {
        GraphNode node = AstarPath.active.GetNearest(points[i], constraint).node;
        var position = (Vector3)node.position;
        path.vectorPath.Add(position);
    }


    // Call the A* Pathfinding API to calculate the path
    seeker.StartPath(path);
    //AstarPath.StartPath(path);
}
private void finishedCaculatePath(Path path)
{
    FinishedCaculatePath?.Invoke(path);
}

The Code

Hi

The vectorPath field is an output of the path calculation. You should not be assigning to it. What are you trying to acomplish?

Trying to create my own path

Ok. I believe you got an answer to that in your other thread.