So, Unity does not make many rhythm games on android. I decided to find out why, and program one as an assignment (the basics of it anyway). My most important hurdle is user input. Since we know that the input is based on the frame rate in unity, and the music game (I suppose) would prefer the smallest possible delay between the press of a button and the action.
If we look at the music, from 15 to 20 ms delay, the human ear hears that something is “turned off”.
I heard that Android Unity games run at 30FPS (since 60FPS sucks the battery dry), simple math shows: 1000/30 = 33 ms per frame. Computing in 15 ms, we probably will not notice, we are in 18 ms of a possible disaster. assuming we always achieve this 30FPS at any time.
When I get an input from a user, I can play the sound at that input on the same frame. However, we could disconnect at 18 m.
Now there is a way to get DIRECT controls with the mouse and keyboard, which uses OnGui () instead of Update () to receive keyboard or mouse click events in place. The problem is that the android probably doesn’t work with this (this also doesn’t work for gamepads), and the methods sound completely strange, especially when we try to play sounds from the OnGui () method.
My question is: What would you do and why? Should we just accept the possible 18 ms and suppose we reach 30FPS, or should we look for a reliable way to direct input instead of waiting for an update?
Thanks for any insight you can give me, I have not yet found articles about this that are still useful. -Smiley
EDIT I just did some basic testing with the metronome, working at 100FPS in the editor (which should be 10ms per frame), pressing my space bar on the metronome inside the unity. The results I got were just awful. Pressing quickly: I reach 20 ms to my metronome, but nothing closer. Pressing the rhythm: I had at least 200 ms from the target tick. If I am not confused by this rhythm, this is simply wrong.
I am currently using Debug.Log to retrieve my test data in a log. Can someone please acknowledge me if this could be the reason (causes some long delay? I know that debugging is not optimized), or is this time really bad?
Thanks in advance, -Smiley