Why is my list bigger than it should be?

I’m generating 3 random waypoints then saving them to a list but when debugged the list is showing a Count of 5, why?

function getWaypionts ()
{
	for (var l=0; l < 3; l++)
	{
		Debug.Log("l is " + l);
		var walkRadius : float = 10;
		var randomDirection : Vector3 = Random.insideUnitSphere * walkRadius;
		randomDirection += transform.position;
		var hit : NavMeshHit;
		NavMesh.SamplePosition(randomDirection, hit, walkRadius, 1);
		var finalPosition : Vector3 = hit.position;

	    waypoints.Add(finalPosition);
	}
	for (var lk=0; lk < waypoints.Count; lk++)
	{
		Debug.Log("waypoint " + lk + " is " + waypoints[lk]);
	}
	waypointsGenerated = true;
}

As Exceptione said, make sure you don’t have anything added to the list within the inspector.

I’d suggest making it a private variable, or perhaps tagging with [HideInInspector] if you don’t actually want to be able to edit these values at edit time.

It might be sensible to run .Clear() on the list before you start adding your data too.

Do you have any in the inspector of the script in Unity that are already in the list before you run the game?

If not, make sure you’re not adding them from anywhere else. At first glance I can’t see anything wrong with the code.