- Home /
"Input.GetAxis()" Lagging?
Something weird is going on here. Basically, I'm running a script that changes a variable according to the value returned by Input.GetAxis. Nothing new, really. The problem is that the change in Input.GetAxis's value seems to lag. It takes a fraction of a second for it to catch up with the rest of the game. Here's my code:
var moveDirection = 0;
var move2 = 0 //for comparison
function Update()
{
moveDirection = Input.GetAxis("Horizontal");
if (GetKeyDown("left"))
{
move2 = -1
}
if (GetKeyDown("right"))
{
move2 = 1
}
}
Shouldn't moveDirection and move2 be changing values at the same time? Why isn't this the case?
This is all by design.
There is a GetAxisRaw option, which isn't smoothed at all.
This actually turned out to be the most helpful option, I think. Thanks a lot.
Answer by Loius · Jun 10, 2015 at 10:06 PM
Your Edit > Project Settings > Input Settings should be adjusted to taste.
Specifically the Gravity (how quickly the input returns to zero after the player releases it) and Acceleration (how quickly the input arrives at the actual value the player is inputting) options of your axes.
I'll have to give this a try. Thanks for the input (pun 100% intended)!
This is another solution: https://answers.unity.com/questions/127573/unbuffered-keyboard-input-delay.html
Your answer
Follow this Question
Related Questions
iOS app 30 fps but laggy 0 Answers
Admob plugin lagging when downloading ad 1 Answer
Is there anybody who can help me to get rid of lag? 1 Answer
Laggy 3D game on Android 0 Answers
Scene and Game Screen Lag 0 Answers