Running into a weird issue with Animation Events. I am trying to disable input when my attacking animation starts, and enable it again when it is finished, using the 2 events you see here:
The first event looks like this:
public void DisableInput() { Debug.Log("Disable"); player.inputEnabled = false; }
And the last event:
public void ResetSwing() { Debug.Log("Reset"); player.inputEnabled = true; _anim.SetBool("Swing", false); }
If I am moving WHILE attacking (holding W + click) the Swing animation just plays the first frame (disabling input) and then stops, leaving my character standing still with input disabled. If I stand still and click, it works perfectly.
My InputController:
private void InputControl() { if (inputEnabled) { if (Mathf.Abs(Input.GetAxisRaw("Horizontal")) > 0.5f) //move { _playerMoving = true; _direction.x = Input.GetAxisRaw("Horizontal"); } if (Mathf.Abs(Input.GetAxisRaw("Vertical")) > 0.5f) //move { _playerMoving = true; _direction.y = Input.GetAxisRaw("Vertical"); } if (Input.GetMouseButtonDown(0)) //mouse btn pressed { _currentAnim.SetTrigger("Swing"); } } }
I used this same script a while ago and it worked as it should, no idea why it behaves like this.
My Animator: