- Home /
2 frame delay from button press till GetKey registers it
So I'm getting into the habbit of running big loops to drop the framerate so I can test stuff on a frame by frame level. I'm running a 80 million loop which gets my framerate to around 1fps. So I've been testing input detection, I press a button (space in my case) halfway through a frame, the next frame happens, then the next and then it's on the next frame when GetKey says that space has been pressed. Is there any reason for this?
Is your Get$$anonymous$$ey inside Update or FixedUpdate?
Answer by Norax · Jul 09, 2014 at 07:15 AM
The next frame should not be responsible to your key input, basically because that frame is being drawn right the moment you click it, and the information is working in with is the one that have been buffered before that current frame has been pressed.
The X frame has been drawn with your X-2 input.
The frame has been processed at X-1.
If you enter an input at X, it will be get by the system at X+1 to be processed and drawn at X+2.
I don't have any documentation to link, so I may be wrong somewhere.
Don't know if you have been doing this, but try to use the monoDev, attached to unity, to debug the behaviour.
Im running my code in Update.
Could you explain what you mean by
Don't know if you have been doing this, but try to use the monoDev, attached to unity, to debug the behaviour
Your answer
Follow this Question
Related Questions
How do I fix the input delay on Unity for Mac? 0 Answers
audio and input latency 0 Answers
Animation delay until certain distance 3 Answers
Touch input reporting 0 delta for first several Updates on iOS, 2 Answers
How to prevent input lag/delay? 1 Answer