Just like the title says: How can I check when the state machine is in transition between two states?
I understand how to retrieve what state the state machine is currently in, but how do I check if its currently in transition.
This is specific because I want to lock the movement and rotation of my GameObject if the state machine attached is transitioning from one state to another?
Is this even possible??
Edit 1: Im looking at the scripting API and am looking at a few classes: AnimatorStateTransition, AnimatorTransition and AnimatorTransitionBase.
The only class that monobehavior allows is AnimatorTransitionInfo. (Sorry if I sound like a noob)
Both AnimatorTransition and the base class have a member variable destinationState. Would this be possible to check the animator objects destination state and lock transform if the destinationState variable contains the state?
Edit 2:
Looks like this bit of code works actually:
//Checks the transition
currentTransition = anim.GetAnimatorTransitionInfo(0);
if(currentTransition.IsName("Run -> Attack"))
{
Debug.Log("Attack transition");
}
A similar question was asked and answered as well:
The person who answered it, might have written it a bit more eloquently than me.
Thanks