I have an object in my game that I want to spin constantly. At times (not always) there may be several of these in one scene.
I have a very simple script that does the job at the moment-
#pragma strict
var spinx : int = 0;
var spiny : int = 3;
var spinz : int = 0;
function Update ()
{
transform.Rotate(spinx,spiny,spinz);
}
OR… would I be better off using an animation? Which is going to be the more efficient option?
The best option will be the one that suits your game. If rotating by script is just as fine as an animation then script will be a better option since you don’t have to worry about keyframe problems and the movement will be steady! But if that doesn’t look good with script , go for animation.
Function Update will keep rotating the object in all 60 frames of your game. If you write animation.Play(“Name”); In the Function Update , it really wouldn’t make any difference since it will play the animation in 60 frames as well. The choice is yours 