Character Animation Gets Rid of Idle Animation

Hi. I am using the character controller and I added another VERY short script so my character could attack. Whenever I play the game, the character does the attack animation but DOESN’T do the idle animation. It is as if the attack animation got rid of every animation except its own. Is that attack script simply overriding the character controller?

Here is my script:

#pragma strict

function Start () {

}

function Update () {
	(Input.GetButton("Scratch");
		animation.CrossFade("Slash");
}

If you have an answer please tell me, I need this answered to proceed.

Thanks!

you need code for that too, something like:

function Update () {
if(Input.GetButtonDown("Scratch"))   //fixed syntax error here
animation.CrossFade("Slash");
else if(!animation["Scratch"].normalizedTime > 0)  // or something
animation.CrossFade("Idle");
}

unless you mean you want them both to blend together, in which case you need to play with blending:

http://docs.unity3d.com/Documentation/Manual/AnimationScripting40.html

looks like this may be deprecated though… I don’t know if there is a newer way now…