-2
\$\begingroup\$

I recently posted this How To Make My First Person Controller turn left and right in unity 5

but now I'm having a slight problem when I press the key that turns my camera it only does it for a little and then it stops. I want to be able to hold say the A or D key in and continue turning until I stop holding that key.

\$\endgroup\$
1
\$\begingroup\$

Input.GetButton() instead of Input.GetButtonDown()

The former checks to see if the key is currently down and outputs true for every frame during the press. The latter checks to see if the key was up last frame and down this frame (that is: true for exactly one frame until released again).

\$\endgroup\$
  • \$\begingroup\$ You might want to briefly introduce the difference between the two functions and why it would fix the issue the OP has. \$\endgroup\$ – Alexandre Vaillancourt Feb 3 '16 at 16:59
  • \$\begingroup\$ yes please explain how to do this a little better please. \$\endgroup\$ – sketcherskt Feb 3 '16 at 17:41
  • \$\begingroup\$ I have updated my answer, @sketcherskt however I am unsure how much use it will be as your question doesn't indicate what scripts you are using and how much knowledge you have of writing code. \$\endgroup\$ – Draco18s Feb 3 '16 at 17:49
  • \$\begingroup\$ im the using the "first person controller" \$\endgroup\$ – sketcherskt Feb 3 '16 at 18:06
  • \$\begingroup\$ @sketcherskt That involves 3 different scripts, easily. \$\endgroup\$ – Draco18s Feb 3 '16 at 18:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.