• Home  / 
  • Unity3D
  •  /  Unity3D Runtime Animating with the GameObjectRecorder

Unity3D Runtime Animating with the GameObjectRecorder

Recording custom animations in Unity just got easier with the introduction of the GameObjectRecorder.  It’s in beta at the time of this writing, but I definitely recommend you give it a try.

To use the recorder, you need to instantiate a GameObjectRecorder, set the root, and bind the transform.

You’ll also need to create an empty animation clip for the object you’re recording.

Then every frame, simply call the recorder’s TakeSnapShot method, and when you’re done, save the clip using the recorder’s SaveToClip() method.

The sample code provided on the Unity forums here is a great way to get started, using it, you can get started recording your animations in just a few minutes: https://forum.unity3d.com/threads/feedbacks-for-experimental-feature-gameobjectrecorder-2017-1.467852/

Here’s a copy of that code:

Using the Sample Code

Find the gameobject you want to record, and add the HierarchyRecorder component to it.

Create an empty animation clip for your gameobject.

Assign that new empty clip to the HierarchyRecorder’s “clip” field.

Start playing, and check the record box.

Move your objects around as desired (this can be done w/ physics, in the scene view, navigation, or other code).

Uncheck the record box.

You’re done, play your animation 🙂

Video Version