I know that Animation.IsPlaying allows me to check if any animation is playing, but how can i check if a specific animation is playing?
3 Answers
3Check the enabled property of the desired animation:
if (animation["funnywalk"].enabled == true)
print("funnywalk is playing.");
You can, but as a workaround I suggest you build an animation manager where you store the animation that it’s currently playing, then you can use it not only to check the currently playing animation but to do an event driven animation manager which can lead you to a really optimized code.
This is for legacy right? Mecanim kinda does away with this. By the way, did you notice you dragged up a three year old QA? :P
– meat5000Yes, this is for legacy, I try not to use Mecanim due to performance issues. Hahaha! yes, I notice but a lot of people still sees this post (has almost 7000 views now) :P
– donmetapod
This does work indeed, whereas animation.IsPlaying("funnywalk") might wrongfully return true from time to time (it seems). Any idea why?
– anon7284922Glad I was able to help.
– Larry-Dietz