How to use crossfade?

Hi, I have a space ship and when it gets hit by an asteroid I want the ship to break apart with an animation. The following is a script I am trying to use. Please help me.

#pragma strict

static var shipBreak : Boolean =false;

Function Start (){
	
    shipBreak = false;
	Animation.Stop ()  ;

	Animation.wrapMode = WrapMode.once;

    var breaker = animation (“Ship_Destroyed”);
    Ship_Destroyed.speed *= breakerSpeed;
}

Function Update (){

	If (shipBreak == true) {
        Animation.CrossFade (“breaker”) ;
   }
}

Also I wrote another script caled animation Instagator and it looks like this…

#pragma strict

Function Start () {
    animationPlayer ();
}

Function animationPlayer() {
	yield new WaitForSeconds (3);

    Ship.running = true;
}

I believe your problem is in the update function, you are cross fading the animation every frame, whereas I think you need to crossfade only once. I would suggest something like this:

if(!animation.isPlaying(“breaker”) && shipBreak) {
animation.CrossFade (“breaker”);
}

You may otherwise want to set another flag for when the ship has been broken so that the animation is only called once. I hope this helps.