How to use CrossFade with anim2 when anim1 is over?

Hi,

i have a problem with the CrossFade system: if i wait for an animation1 to complete, the crossFade of animation2 won’t work.

And if i don’t wait for the animation1 to complete, animation2 will be triggered because the Update function is automatically called. Would you know how to solve this problem?

In this code, i check the state (“ExtremeLeft”) to play “dde” (animation1) then “d7” (animation2), or just play “d7” (animation2) with “CrossFade” :

	if ( Input.GetAxis("Horizontal")>0 ){
		//RIGHT
		if (current_state == AnimState.ExtremeLeft) {
			animation.CrossFade("dde"); //works fine (animation1)
			animation.PlayQueued("d7", QueueMode.CompleteOthers); //animation2
			current_state = AnimState.ExtremeRight;

		//} else if (!(animation["dde"].normalizedTime <0.5)){ //(does not work)
		} else if (!animation.IsPlaying("dde")){ //crossFade of "d7" won't work
			animation.CrossFade("d7"); //**HERE**
			current_state = AnimState.ExtremeRight;
		}

Thanks


SOLUTION (EDIT)

Ok, this is working:

	if ( Input.GetAxis("Horizontal")>0 ){
		//RIGHT
		if (current_state == AnimState.ExtremeLeft) {
			animation.CrossFade("dde");
			current_state = AnimState.ExtremeRight;
		} else {
			if (current_state == AnimState.Straight) {
				animation.CrossFade("d7");
				current_state = AnimState.ExtremeRight;
			} else {
				animation.CrossFadeQueued("d7");
				current_state = AnimState.ExtremeRight;
			}
		}
	} else if (Input.GetAxis("Horizontal")<0 ){
		//LEFT
		if (current_state == AnimState.ExtremeRight) {
			animation.CrossFade("dx7");
			current_state = AnimState.ExtremeLeft;
		} else {
			if (current_state == AnimState.Straight) {
				animation.CrossFade("dg7");
				current_state = AnimState.ExtremeLeft;
			} else {
				animation.CrossFadeQueued("dg7");
				current_state = AnimState.ExtremeLeft;
			}
		}
	}

Queue your animation up with cross fade.

Documentation on CrossFadeQueued