In my Player Animator, I’ve added this to an animation’s behavior:
public class Attack_Finished : StateMachineBehaviour
{
public Animator animator;
public void OnStateExit()
{
animator.SetBool("Attacking", false);
}
}
However, when I try to set the animator in the Inspector, the Player animator doesn’t show.
How then do I have a bool in the animator set from inside that animator when an animation ends?
Since the bool change corresponds to a mouse click, I worked around it by detecting a click in my PlayerController and setting one bool there that in turn modifies the one in the animator.
if (Input.GetMouseButtonDown(0))
Attacking_Sword = true;
else
Attacking_Sword = false;
if (Attacking_Sword == true)
animator.SetBool("Attacking_Sword", true);
if (Attacking_Sword == false)
animator.SetBool("Attacking_Sword", false);
Of course, this might only work for others if they face that priblem in a similar context.