hi I want a function that returns the name of the animation playing as a string
While Unity is in a transition phase between Legacy and Mecanim animation systems, please specify which system you’re using. Also specify 2D or 3D.
Unfortunately, in both systems there’s no good way to get this information because multiple animations can play at the same time, using blending, masking, and/or additive animation.
In Mecanim, you can get information about the current state with Animator.GetCurrentAnimatorStateInfo().