2D animation problems: Sprite wants to finish first animation before moving to the next

I am animating a 2D escapists sprite which works ok.
By pressing the arrow keys or wasd you go in the direction you want and the animation points in that direction but the thing is, it wants to wait for the last animation to finish before moving onto the next one when you press the key causing a randomly timed delay.

It would be great if you could give me a solution.

here is the animation script and I have also attached a picture of the animator:

#pragma strict

public var anim : Animator ;

function Start () {

anim = GetComponent("Animator");

}

function Update () {

if(Input.GetKeyDown(KeyCode.A)|| Input.GetKey(KeyCode.LeftArrow)){
	anim.SetBool("Left",true);
	anim.SetBool("Right",false);
	anim.SetBool("Up",false);
	anim.SetBool("Down",false);
}
{

if(Input.GetKeyDown(KeyCode.D)|| Input.GetKey(KeyCode.RightArrow)){
	anim.SetBool("Right",true);
	anim.SetBool("Left",false);
	anim.SetBool("Up",false);
	anim.SetBool("Down",false);
}
{

if(Input.GetKeyDown(KeyCode.W)|| Input.GetKey(KeyCode.UpArrow)){
	anim.SetBool("Up",true);
	anim.SetBool("Right",false);
	anim.SetBool("Left",false);
	anim.SetBool("Down",false);
}
{

if(Input.GetKeyDown(KeyCode.S)|| Input.GetKey(KeyCode.DownArrow)){
	anim.SetBool("Down",true);
	anim.SetBool("Right",false);
	anim.SetBool("Up",false);
	anim.SetBool("Left",false);
}
}

}
}
}

Remove the Exit Time for the all of the animations in the Animator. This way, you can interrupt them with a press of a button to go onto the next state.

  1. Move to animator window.
  2. Click transition line.
  3. Change the value of Exit Time equal to 0

Here’s picture that helps you.

Click on the transition line and Make sure that exit time and all sub times are zeros to get a direct animation switching.