Animation gets stuck in the last frame for 2 secs.

So i’m working with animations through code and not with mecanim.
Until now everything works fine (transition between animations is still horrible), the problem that i’m having is when the BA1 animation gets called. When it gets called it’s plays perfectly untill the last frame. When it hits the last frame it gets stuck for 2 secs. After about 2secs the IDLE animation gets played.

I want that the IDLE animation gets played right after the BA1 animation is finished playing. Instead of it getting stuck for 2 secs and then the IDLE gets played
I don’t know if this is a bug in unity or that it’s just me being a newb at coding.

Here’s the script:

var ForwardSpeed : float    = 20;
var SideSpeed	 : float 	= 13;
var BA	 		 : boolean  = false;
var Walking      : boolean  = false;
var IDLE         : boolean  = false;
var Running      : boolean  = false;

function Update () {

	var forward : float = Input.GetAxis ("W") * ForwardSpeed;
	var side 	: float = Input.GetAxis ("Horizontal") * SideSpeed;

	forward *= Time.deltaTime;
	side *= Time.deltaTime;
		
	transform.Translate (0, 0, forward);
	transform.Translate (side, 0, 0);	
         
	if (Walking){
		IDLE 	 = false;
		Shooting = false;
		Running  = false;
		}
		
	if (BA){
		Walking = false;
		IDLE 	= false;
		Running = false;
		}
		
	if (IDLE){
		Walking  = false;
		BA       = false;
		Running  = false;
		}
		
	if (Running){
		IDLE     = false;
		Walking  = false;
		BA       = false;
		}
		
	if (Walking == false && BA ==false){
		idle();
		}
		
	if(Input.GetButtonDown("W")){
	 	WalkingForward();
	 	}
	 
	if (Input.GetButton("Fire1")){
		BasicAttack();
		}
		
	if (Input.GetButtonDown("space")){
		Sprinting();
		}
		
	if (Input.GetButtonUp("space") && Input.GetButton("W")){
		WalkingForward();
		}

	if (Input.GetButtonUp("W")){
		Walking = false;
		}

	//if (Input.GetButtonUp("Fire1")){
		//BA = false;
		//}
		
	if (Input.GetButtonUp("space")){
		Running = false;
		}
}
	
function idle (){
	GetComponent.<Animation>().Play("IDLE");
	IDLE = true;
}

function WalkingForward (){
	GetComponent.<Animation>().Play("Walk");
	Walking = true;
	ForwardSpeed = 8;
	SideSpeed    = 8;
}
	
function BasicAttack (){
	BA = true;
	GetComponent.<Animation>().Play("BA1");
	yield WaitForSeconds(GetComponent.<Animation>().clip.length);
	BA = false;
}

function Sprinting (){
	GetComponent.<Animation>().Play("Sprint");
	Running = true;
	ForwardSpeed = 15;
	SideSpeed    = 15;
}

Instead of calling to BasicAttack() in line 52, you should start it as a coroutine, because you are using “yield” inside the function.

But seriously. You should really really switch to Mecanim, especially for state machines like this one. No excuses!