- Home /
Check when animation ends playing
How should I check when my animations ends? I am trying to instantiate an object when the animation ends. The problem is that the animated object is a prefab and gets spawned in and destroyed. I was thinking of doing animation events, but i think it would make too much scripting mess.
Comment
Answer by TUTOCF · May 31, 2018 at 09:41 PM
You can simply write this :
if(YourGameObject.GetComponent<Animator>().enabled == false)
{
//do what you want
}
Don't forget to declare your gameObject. Hope this helps!
The Object needs to be deactivated after animation finishes tho.
Your answer
![](https://koobas.hobune.stream/wayback/20220612163806im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Can I make animations snap to a frame? 1 Answer
Detect animation end when drag all sprite to Hierarchy view 1 Answer
How to select an animation clip by index number? 7 Answers
Stop a function? 3 Answers