Simple rotating cube reversal

I’m going through a book on Unity, and this chapter was about using a script to rotate a cube, and stop rotating when the cube is clicked on. I decided once done with the chapter to fork the script and make one that would rotate a cube, and when clicked on would slow down and then begin rotating in the opposite direction.

The issue is that when rotationSpeed hits 0, it stops entirely. I tried kickstarting it by waiting a frame and then setting it to the value I change it by, but it doesn’t accelerate after that. Script here, in JavaScript.

It looks like rotationSpeed should be a float instead of an int. Hope that helps.

Yeah, that worked. Thanks. I have an issue with the double click that I intended to make stop the cube slowly stopping it immediately, but I’ll figure that out pretty quickly.