StateMachineBehaviour get name ??


how can i get this name ?? and put to string ??

theres no way to get the name directly but you can get it by comparing it to a list of names you think it has by using the animator function cA.GetCurrentAnimatorStateInfo(i).IsName(“string”);

For what reason exactly do you want this string? The OnStateXXX methods have a AnimatorStateInfo as second parameter. This data structure contains the shortNameHash. If you want to do some comparison with another state name for instance, you can do

if(stateInfo.shortNameHash == Animator.StringToHash("yourString"))

Knowing what you exactly want to do might help giving you an appropriate answer.