I’m new to Unity and C# and currently playing around with character movements.
I want my character to run when pressing the right trigger of my xbox one controller.
I only have following problem: when pressing the right trigger, my running speed is added infinitely; when releasing the right trigger the running speed is subtracted infinitely.
How can I apply my running speed to my character only when the right trigger is pressed?
(Meaning as soon as I release the Trigger the speed is my ‘normal speed’).
This is the code:
if (Input.GetAxis("Run") == 1)
{
speed += running;
}
if (Input.GetAxis("Run") == -1)
{
speed -= running;
}