- Home /
Get the current StateMachineBehaviours given an Animator
I have an Animator component. I would like to get the current state on each layer and get the StateMachineBehaviours attached to those states. How can I do this?
Thanks, Ves
Note: looks like StateMachineBehaviour is not currently a tag. Please can a moderator add it?
Did you ever figure this out? Trying to do the same thing. I want to add some custom variables to each state, so I can do things in script based on those variables ins$$anonymous$$d of the state name/hash/tag.
$$anonymous$$y $$anonymous$$m ended up just making a state machine separate to Unity's animation states. Gives us way more control, and allows for Update AND FixedUpdate messages, among other things.
Your answer
![](https://koobas.hobune.stream/wayback/20220613192239im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to get fileID information so i can just edit Mecanim Animator through script? 2 Answers
How can I know if the currentAnimState is mirrored or not? 0 Answers
Macanim Mouse Buttons interaction c# 1 Answer
Object stuck when I add new state in animator 0 Answers
Easier way of creating transitions in the animator? 1 Answer