How it works...

To check the Animator state our character is currently in, we first use the GetCurrentAnimatorStateInfo(int layerIndex) function to get the state the character's Animator is in. We need to call this function on the Animator component; thus, we need to have a variable storing a reference to it (anim in our example). Then we call the IsName(string name) function on the state we got from the GetCurrentAnimatorStateInfo(int layerIndex) function. The IsName(string name) function compares the Animator state name to the name we put as the parameter.

We need to specify the full name of the state. This name needs to be in this format: <Layer Name>.<State Name>. For instance, our SpiderIdle state is in the Base Layer, so we need to put Base Layer.SpiderIdle as the name parameter in the IsName() function.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.192.59