Hey Guys,
I’ve just started messing around with the Animator and I’m having a small runtime error with the state machine in the Animator.
I’ve got this bit of code below that checks for a mouse button click and sets the condition of the bool to true which should transition the state machine to the next state which plays the slashing animation. Once I let go of the button it sets the bool back to false returning it back to the default state.
if (Input.GetKeyDown(KeyCode.Mouse0) && Sword.transform.IsChildOf(WeaponHold.transform))
{
otherAnimator.SetBool("Clicking", true);
Debug.Log("Slashing");
}
if (Input.GetKeyUp(KeyCode.Mouse0) && Sword.transform.IsChildOf(WeaponHold.transform))
{
otherAnimator.SetBool("Clicking", false);
Debug.Log("Slash Reset");
}
The debug logs show up on the console.
This is my state machine currently
I should clarify that the “StillSword” state works and the “Sword” state works.
What I’m wondering is when I press the mouse button why it won’t play “Slash” animation. I’m pretty sure its something simple that I’m just not aware of about in terms of the Animator.
Thanks