Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct here to familiarize yourself with the rules and how to post constructively.

  2. Unity 2022.1 is now available as the latest Tech release.
    Dismiss Notice

return name of animation playing

Discussion in 'Animation' started by Raybrand, Mar 14, 2014.

  1. Raybrand

    Raybrand

    Joined:
    Feb 6, 2012
    Posts:
    98
    hi I want a function that returns the name of the animation playing as a string
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,925
    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().
     
unityunity