I think there’s a more practical way to implement dodge without direction input. Instead of doing nothing (no dodge), automatically dodging backward is better for gameplay, so I redo my OnDodge method like this and it works perfectly. Hope someone finds it helpful.
private void OnDodge()
{
if (stateMachine.InputReader.MovementValue == Vector2.zero)
{
stateMachine.SwitchState(new PlayerDodgingState(stateMachine, new Vector2(0f, -1f))); // if no direction input, player dodge behind
}
else
{
stateMachine.SwitchState(new PlayerDodgingState(stateMachine, stateMachine.InputReader.MovementValue));
}
}