Simple Animation Script

Hi all,
I’m fairly new to Unity, altho I do have some programming experience. I’ll also admit my understanding of the basics of coding in unity is still being pieced together, however this is the problem i’m having(any help would be greatly appreciated)

var speed= 3.0;
var rotateSpeed= 3.0;
function Update ()
{
var controller : CharacterController = GetComponent(CharacterController);

transform.Rotate(0, Input.GetAxis("Horizontal") * rotateSpeed, 0);

var forward=transform.TransformDirection(Vector3.forward);

var curSpeed= speed *Input.GetAxis("Vertical");

controller.SimpleMove(forward * curSpeed);


if (Input.GetAxis("Vertical") > 0.4)
	animation.CrossFade ("run");
else
	animation.CrossFade ("idle");
	
	
if (Input.GetButtonDown ("QuickStrike"))
	animation.CrossFade("1HAtt1");
}

@script RequireComponent(CharacterController)

The problem is, my animation for 1HAtt1, stops midway. how might i fix this?

Anyways have you checked the animation settings in your inspector. The ending frame for 1Hatt1 animation might be ending at frames shorter than your actual frames. Take a look at this. http://unity3d.com/support/documentation/Manual/Character-Animation.html
Hope it helps. :smile:

no the frames are correct. I’ve also read over that a few times today. knowing what would cause this to happen would help alot tho :smile:

ahh i found my error. I set it to loop :eyes: once I set the layer to 1 so that i could crossfade the animation, the problem resolved itself. thanks i did need to read that page again :wink: