InputVCR – Make recording/replaying actions in Unity a bit easier

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’s got to be an easier way!” (you may say)
[UPDATE: Example project now available in the asset store. Or check out the example scene]

From a site called "Classrooms of the Future" !?!?

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!

5 thoughts on “InputVCR – Make recording/replaying actions in Unity a bit easier”

  1. hi there eddie..
    i would like to use this cool tool u have made..i wonder if u could give me a little help ? i am making an app that really needs this kind of stuff . i dont really get the instructions on how to use this.would u mind helping? ^_^ hope u will reply soon.. BTW i am new to unity ^_^..thanks u make cool stuffs..thanks

    1. I’d get the example project and take a look at how the scene is set up. Essentially, you need to put an InputVCR script on the object you want to control, and choose which inputs you want to keep track of on the component (inputsToRecord variable). Then you need to go through any other scripts on the same object, and replace any references to Input with a reference to the InputVCR component. So Input.GetAxis( “Horizontal” ) becomes myInputVCR.GetAxis( “Horizontal” )

      I don’t see any reason it wouldn’t run on android, although you’d have to be more careful about large recordings taking up memory than on a PC.

      Hope that helps

  2. and by the way eddie is this available in android? please reply..really need to know this stuff i have a deadline on feb 25 2014would really apreciate if u reply thanks.. ^_^

Comments are closed.