To check which Animator state is currently active, follow these steps:
- Import the character to Unity.
- Create an Animator Controller for it or use an existing one.
- If you want your character to react to hits, follow the Using transitions from Any State to play hit reactions recipe.
- In this recipe, we are going to use the healing action as an example. Create a new script and call it Healing.cs. In this script's Update() function, first we check if player pressed the H key. Then we check if our character is playing in the proper Animator state and saved in the public stringhealingAllowedState variable. We also check if a healing action is not active because we don't want to stack healing actions. If all these conditions are ...