One of my current projects, needed the ability to record player input, then play it back on an object. This is something I’ve had to do several times already. In Muckraker it was how you could ‘film’ something. Rather than record all the changing variables on an object/character (position, rotation, whether they are firing…) you can in most cases just record what the player does. When you play back this input, the object will do the same things and act the same way. (keep in mind that external inputs, like physics, can make the object drift off course after a while, but this can usually be minimised). Even so, keeping track of inputs and playing stuff back without ‘live’ input getting in the way can be a headache.
There sure is! InputVCR, is a script you can put on any gameobject, and by simply changing the mode (passthru/record/playback) you can switch between live and recorded input. You just need to change any references to “Input” to point to an InputVCR component, otherwise your carefully set up input scripts don’t even have to know if input is live or not.
It works pretty well so far, but let me know if you come across any bugs. I might add some easier way to add position/rotation “keyframes” to make sure that objects don’t get too far off track, as well as a better way to store recorded input (at the moment it only stores them in local strings). I also might upload an example package to the Unity Asset store in a few days, so look out for that if you are having trouble.
Grab it from GitHub here and play around with it!