What is the way to go for animating simple objects?

Unity has several ways to implement animation of elements on screen, and I don’t really know which is the “correct” (best, more generic, most flexible) way to do this.

We have mecanim, which seems to be more oriented towards “things with bones” (i.e. characters) with all the animations graphs and whatnots but that it seems to be the “official way to go” nowadays, the (legacy) animation view, which allows us to make simple clips and play them, and some basic functions to move arond stuff that reminds me of that funny time I messed around with OpenGL.

Most of posts that talk about moving stuff points towars the basic functions, all stuff that points towards the legacy animation view seems to be from 2013 (before the mecanim arrival), and I haven’t seen any tutorial oriented towards making siple stuff move around in mecanim.

So, right now, I just want to rotate a cube. Wow. Big deal. But today’s cube rotation could be tomorrow spaceship movement, and I hope next week something a bit more interesting or complex.

So, should I try to go for Mecanim to do ultra simple things I’ve already done with some functions? Does anyone keep using the old animation view?

If you only want to translate, scale or rotate an object i would recommend writing a simple script that does these actions for you. There is no need to use an animation system for these operations and it keeps the project more simple and clean.

All in all it comes to your own preferences, but if you decide to go the non-scripting route, I would definitely recommend using Mecanim. Like you said, because you’re just rotating a cube doesn’t mean that’s everything you need to do in the future. Mecanim is a very powerful animation system and you can’t go wrong by learning to use it.

The future is ahead of us and there is no need to use any of the old legacy components.

I would recommend iTween. It’s a free asset and it’s so essential and so simple to use that i actually think it should be integrated into Unity.

Most simple animations can be achieved with a one-liner.

I try not to use animator for things that don’t need an animator or a ton of sprite refs

public int AnimateFrames;

	void Start () {

		InvokeRepeating ("AnimateUpdate", 0, 0.125f);

	}

	void AnimateUpdate () {

		AnimateFrames++;

		if (AnimateFrames % 4 == 0) {
			this.transform.localPosition = new Vector3 (this.transform.localPosition.x, 1f / 32f, this.transform.localPosition.z);
		}
		if (AnimateFrames % 4 == 2) {
			this.transform.localPosition = new Vector3 (this.transform.localPosition.x, 0, this.transform.localPosition.z);
		}
    }