Good night my friends, i need some help here.
First of all: I searched and i found a solution, but not an optimal one.
What i need? Print the current playing anim clip.
I have a project for the sign language for deaf people. One avatar, but thousands of animation clips, one for each sign. So, i need to place a subtitle saying which animation i am playing at the current moment.
I used things like:
foreach( AnimationState anim in GetComponent() ){
if( GetComponent().IsPlaying( anim.name ) ){
if(anim.name.Split(’ ‘)[0].Equals(“_default”)) return null;
return anim.name.Split(’ ')[0]; //This is made to remove “cloned queue” tags.
}
}
But this is not optimized. I am iterating over this component again and again, wasting time and memory. When i place many animations on the Animator, this method causes lags.
I just want a method to list the current anim file which is playing.
If i have 1000 and i am playing one of these, i just want return it’s name! Simple. But i found no solution.
Animation.isPlaying(“anim”) returns true if “anim” is playing. Without the parameter, another bool. I just want a string!!
Thanks in advance and sory for my poor english skylls!