(HELP)Character is not moving back smoothly when finishing an action(Snaps back to value).

I’ve been using Unity for four years, and I’m making a small Sonic project.

One of the issues I’m having is that whenever I make Sonic perform an action that requires him to stay still, such as crouching, he instantly shoots back into his full speed when I release the button while still holding on to a input value. For example, I made my own stomp, and when he lands from it, he instantly goes back to full on dashing when holding the forward key. He gradually gains speed just like the games when I’m not performing any actions, but as soon as I need him to be stationary after the action is finished, that’s when the problem occurs.

I’ve tried two methods:

  • setting the input values to zero (didn’t work)
  • using Vector3.zero (also didn’t work)

I am very dedicated to this project, so if anyone can help me out, I would greatly appreciate it.

I’ve provided an example below from Sonic Generations. When he stomps and starts gradually moving again, he doesn’t instantly shoot back running again. I am also using a Character Controller Component.