Want GameObject to go back to where it was before Animation!

Hi there, I’m not so good at scripting but I’m trying my best.
I have some Animations on a GameObject. And when the Animations stop, The GameObject doesn’t go back to where it was before tha Animation. I think I need a Script for this, But how am I supposed to Script that?

Like I said, I’m not good at Scripting so a link to Script or a ready Script would help me out!
Thanks for your help! :smile:

Wan to do want exactly, something like, idle then run then idle ?
if this is what you need, you can try something like :

var state="idle";
var tochange=true;

function Update()
{
	//STATE INITIALISATION
	state="idle";

	//CHECK KEY AND APPLY STATE
	if(input.GetAxis("Horizontal")!=0){
		//move your character's tranform
		state="walk";
		tochange=true;
	}

	//CHANGE ANIMATION ONLY IF NEEDED ACCORDING TO STATE
	if(state=="idle"&tochange){
		animation.CrossFade("idle");
		tochange=false;
	}else if(state=="run"&tochange){
		animation.CrossFade("run");
		tochange=false;
	}

}

If nothing is done, the state is in idle and if it is not already done it changes the animation to idle animation.

Unity just recently put out a tutorial that briefly goes over the animator and animations. It’s in 2D, but the same method of using the animator applies to 3D. This should help you figure it out:
http://unity3d.com/learn/tutorials/modules/beginner/2d/2d-controllers

I forgot to put in the code before //CHANGE ANIMATION…

if(Input.GetAxis("Horizontal")==0&state!=idle){
state="idle";
tochange=true;
}

But you can see how to do it easily