IEnumerator reset?

Is there a way to reset an IEnumerator in JS?



In particular, I'm using the functions here:

I'm doing this:

var points = Interpolate.NewCatmullRom(applePositions, betweenNodeCount, loop);

Then another bit of code:

    while (points.MoveNext()) 

This calls the extrusion routines from the Unity3D procedural examples.

The general answer is "yes" -- an enumerator is normally reset with IEnumerator.Reset, as per the interface.

But a particular implementation of IEnumerator may throw an unsupported exception in the Reset method. And sadly, that is the case in your situation. The enumerator in question comes from a method that uses "yield return", and as per this stack overflow question, you can't reset such an enumerator.

So the answer is no (unless you modify that script to implement an enumerator that supports Reset).