Help with Animation State Machines

I’ve just started working with the new animation system from 4.3, and the state machine tool is really nice. However, it doesn’t seem easy to just get the current state of an animator’s state machine.

I’m trying to use the animation state machines to drive state machines in code, but it seems unnecessarily difficult. Can anyone help with this?

Thanks.

I just use an int for the states:
0 = idle; 1 = walk etc, calling this animState;
Then I use getInteger(“animState”);
To change setInteger(“animState”,0);

Once you’ve identified a variable, you can use it in the transition. Probably better ways, but I just started using it. I code everything in a script for changes.

Unity - Scripting API: Animator.GetCurrentAnimatorStateInfo ?

I suppose that the StateInfo is usable, but you can’t directly access the name. You can only ask if the name is the right one. It seems so strange. Does anyone know why they do it that way?

It’s for memory and speed reasons. Hashing a string just gives you an integer, which is smaller to store and faster to compare.