MoveTowards not moving towards! lol.

Can someone do a check on this and see if this works on their end? It seems right to me, and the strange part is that the print statement is firing off every time the while statement loops, yet the object “tractor” will not move!

function StartTractor ()
{
	//find the z value by searching through spawner array and comparring y value 
	var findZ:	float;
		
	for (var spawner : Transform in alienSpawnPoints)
	{
		if (spawner.localPosition.y == targetObjectRow)
		{
			findZ = spawner.position.z;
		}
	}
	// sets up the starting position for tractor
	var startPosition 	= Vector3(-8.6, targetObjectRow, findZ);
	var endPosition		= Vector3(9.6, targetObjectRow, findZ);
	var step 			= 5;
	Instantiate (tractor, startPosition, Quaternion.identity);
	
	while (tractor.transform.position != endPosition)
	{
		tractor.transform.position = Vector3.MoveTowards(tractor.transform.position, endPosition, step * Time.deltaTime);
		print ("in here");
		yield;
	}
	
	Destroy(tractor);
}

Anyone have any theories why the print fires off, yet the object will not move to it’s end goal?

You may want two separate variables: tractor and tractorPrefab.

tractor = Instantiate(tractorPrefab, startPosition, Quaternion.identity);

Point being, Instantiate returns a reference to the clone. Since you don’t save that reference anywhere, you effectively lose track of the newly cloned tractor just as soon as you create it.