- Home /
Animation doesnt play ??
Good morning following problem still working on a flappy bird like game i want an explosion animation to play when metal objects are hit.
public Animation Explosion;
void OnCollisionEnter2D(){
// call die function
// die();
//call Explosion animation
Explosion.Play ("Explosion");
}
With the Die Function it is working but the explosion doesnt work ? there is no error nor animation and i´m a bit stuck Animation is assigned in the prefab the animation itself is set to play once (but loop doesnt work either)its set to legacy like unity wanted me to do but still no animation played
The animation is not played if you call die function ?
If so, the problem comes from the die function, please, give us more details and at least the code of this die function if you want to be helped.
try:
GetComponent<Animation>().Play(Explosion.name);
Also, shouldn't Explosion be AnimationClip ins$$anonymous$$d of Animation?
Is this script attached to the same object that has animation component and the object that is going to die? We need more data to help.
Your answer
Follow this Question
Related Questions
How can I have two scripts in the animator panel ? 1 Answer
why I have to anim.getComponent in update() function when I had done in Start () function 2 Answers
First script plays animation but second script stops if from playing said animation 1 Answer
Scale up/down animator not staying at the scale once the animation finishes 2 Answers
Animating a Panel,Animating a panel 1 Answer