- Home /
Light explosion animation not working.
Hello Everyone, I am trying to make a game in which there are 2 cars translating towards each other and i want to show an animation(Light explosion) on collision. I have written the following script:
function OnCollisionEnter(collision:Collision)
{
if(collision.gameObject.name == "car2")
{
//Play animation
animation.Play("Light explosion");
}
}
I have attached my script to game object.But animation doesn't seem to work.Any idea???
Answer by Kiloblargh · Dec 17, 2013 at 08:22 AM
Try this:
var lightExplosion : AnimationClip;
Drag and drop the clip to the slot in the inspector. Then :
animation.clip = lightExplosion;
animation.Play();
Isn't the animation clip already present in animations?from where we need to drag and drop the animation?
From the Project view tab, wherever you created it originally in the Assets folder.
I haven't created any animation,I want the inbuilt animations.
There are none such. there's certainly not a built-in animation called "light explosion". You are just confused and you need to stop and RTF$$anonymous$$ before you go any further.
Your answer
![](https://koobas.hobune.stream/wayback/20220613124334im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to control speed of animation on Unity by a .txt file? 1 Answer
How to make animations only play with script? 1 Answer
[Solved] Generating Particles with Attack Animation 1 Answer
Animation position changes everytime I play the animation 1 Answer
How would you reccommend adding the jumping animation to my script? 0 Answers