- Home /
Is there a way to get precise input ?
Input is called in frame Update with getKey function, but it means it's verified every 16ms (or more if you dont unable Vsync but still dependent of the framerate).
Is there a way, or a plugin (i got pro), to got very precise input in time ?
But what would be the use ot it? Your issue I think is not about checking the input more often but about increasing your FPS. Even if you could check your input every 5ms, the frame rate is still 16ms. So only the last one (or the first one) would be considered. Even if you put 20 letters in the postbox, it is collected once a day. Or I misunderstood.
It's for a musical game. I need very precise input for checking the exact moment (or with a very nice precision) of when the users push a button.
I don't necessary needs to doing something DIRECTLY when the input is raised, but i just need to know the exact or very precise time of when the users push a key.
Actually, i cheat. I force the disable of VSync, set the targetFrameRate to -1. And, even in a 5 years old computer, i get 200 FPS, which is 5ms accuracy, which is pretty good.
But i was asking for a more "clean" solution ?
Yep, i already know it's difficult, and of course i don't expect precision to milliseconds. But 5ms will be fine.
I'm just asking myself how others musical games works, are they got the problem too, or are they doing something else ?
Other musical games cheat, too. They have to. For consoles, they can have the additional problem of latency between a wireless controller and the console. There's also the issue of modern technology like HDTVs and capacitive touchscreens (like on most mobile phones) having performance issues for games with really tight accuracy: http://www.gamasutra.com/view/news/174502/Your_HDTV_killed_PaRappa.php#.UFdIH41lS3Y
Can you not use Get$$anonymous$$ey in FixedUpdate (you would have to handle your own Down/Up notifications because they won't work in FixedUpdate)? Then you'd set your fixed update step to be 200x per second.
Answer by SarperS · Sep 17, 2012 at 03:59 PM
Here, Sophie posted this, might help. http://www.sophiehoulden.com/super-fast-input-in-unity/
Well.... Testing a bit and ... it's not perfect :D See the comment of "Nicholas" in comment, and he's right. OnGui() is completly frame dependant and the difference between this trick and just put input as usual is nothing.
Your answer
Follow this Question
Related Questions
How do you correctly setup multiplayer using InControl? 0 Answers
Having issues with Input.GetKey... 3 Answers
Is it possible to change keyboard input inGame 1 Answer
problem whit input key 2 Answers
Car Enter/Exit Script Problems 1 Answer