(And here's the code to record/read input)
I see, I thought you used some weird function of Unity, but that's a pretty simple and clever solution!