I’m working on a tps with the traditional wasd movement and correcting the character rotation according to its direction relative to the camera (by pressing w you see the character’s back while pressing s shows the character facing the camera and so on).
The problem is that, if I use Input.GetKey(KeyCode.A) for instance, it works but the key cannot be later changed in the input manager. On the other hand, Input.GetButton can be setup during the game but it doesn’t work (it messes up the character rotation god knows why).
try using
Input.GetAxis("Horizontal");
instead. That way the Axes can be assigned in the input manager, and specific keys can be assigned to + and - values for one axis (e.g. “w” for + vertical, “d” for - vertical). This will work for buttons and joystick.