Input Delay on Crouch (Unity 2D)

in #blog2 years ago

Sometimes it's the simpler solutions...

Pixel Art Sprite of Robot

Alright, so, Unity folk, check this out. I was going to continue working on animations and transitions etc, but instead I decided to go after a problem that had been plaguing me for a long time that I had never resolved.

“Delayed Crouch Input"

I couldn't figure it out, I looked everywhere, I didn't know if it was somehow an issue with Unity itself, or the corgi plugin. I was pouring through the crouch script to see if I could spot something in there that was causing the delay, I tried different scenes that had been created by the corgi developers themselves, but no solution was found...

SO, I took different approach, I plugged in the USB xbox controller, and wouldn't you know it... crouching with the joystick showed ZERO delay! Even when I looked at the raycasting in the scene window, I could see that the arrow was responding EXACTLY as I pushed down.

Unity Screenshot showing downward raycasting for sprite

So what could it be? Could my keyboard itself be delayed for some reason? I looked into remapping the controls, which turned out to have nothing to do with corgi itself, but Unity's input settings under "Edit > Project Settings > Input". I tried changing crouch to other keys, but the issue remained... until I noticed one field in the options, "Sensitivity", set to 4... I changed it to 1000 and surely enough, the delay was FINALLY fixed!!!!

Overjoyed that I finally found the problem and fixed it, however kind of enraged at whoever set 4 as the default sensitivity lol.

Settings showing input sensitivity cranked to 1000

So if you're ever having what appears to be input delays, BE SURE to check the sensitivity on the input settings.

Peace out ladies and gentlemen, ‘twas a fruitful game development session, and am PLEASED.