do...while with Transforms?

I’m attempting to create a framework wherein I can move an object, regardless of type, along a set path defined by an n-dimensional array of path waypoints.

In the following method, _currentTarget will always be the next waypoint (index) in the array, or the previous point if we’ve reached points.Length (this is obviously not currently implemented, I just mention it for context).

As written, this method returns the error: Operator '<' cannot be applied to operands of type 'Transform' and 'int'

void MoveObject(Transform[] points)
        MovableObject.transform.position = Vector3.MoveTowards(MovableObject.transform.position, _currentTarget, MoveSpeed*Time.deltaTime);

        var i = 0;
            // Move the object
        } while (points *< points.Length);*

I’ve found out that Array.Length returns not the number of indices, as I had thought, but the total number of elements in the array. So, for a Transform component, we’re talking nine elements per index, right? While I think I understand why it doesn’t work, I still can’t figure out how to fix it.
How would you refactor the method, given the above constraints?



is the transform at the i’th position in the points array. As the error says, you can’t ask if a “Transform” is less than some int value (points.Length). You want to compare “i” itself, not points*. So…*
while (i < points.Length);