'Clear' a Coroutine?

Hi, all!

Running a rotation script in a coroutine. It saves the rotation of an object at the beginning, then loops through some leaping code, then snaps the rotation to the previous rotation plus desired degrees for good measure.

This always works the first time.

After that, on the snapping step, my object rotates to the orientation it was in after the first trial. My theory is that the coroutine is somehow holding on to the local variables that are set before the loop, and not ‘clearing’ them even when StopCoroutine() is called.

Am I doing something wrong here?
Feel free to ask for example code if I am being unclear.

Cheers! - YA

I’m pretty sure locals in coroutines work just like regular locals. Print it and see. Think it’s just bad code somewhere.

I am seeing firstRot.x on line 23, which is the unknowable quaternion value which should never be used (missing eulerAngles.) But I think, instead of even eulerangles, transform.rotation*Quaternion.Euler(0,0,degrees); is nicer.

But that error should make it wrong all the time, even the first time.