I've noticed when I use C# code to move a game object in response to a keypress, that holding the key down for a few seconds nonstop causes the object to continue moving for a moment after I release the key.
Alternatively, if I just jab the keys quickly, the object starts and stops instantly.
Is this some kind of key queuing and can it be disabled?
Here's the basic code I used to do the move (Spuddie is just a sphere with "arms" along it's axes):
public class SpuddieMover : MonoBehaviour
{
public GameObject Spuddie;
private void Update()
{
float z = Input.GetAxis("Vertical");
if ( z > 0)
Spuddie.transform.Translate(Spuddie.transform.up * Time.deltaTime);
else if (z < 0)
Spuddie.transform.Translate(Spuddie.transform.up * Time.deltaTime * -1);
}
}
Thanks in advance for any help! :)