Store and Restore an object's state

I’m working on a custom “Cinematic Editor” where I can take objects and apply actions to them based on the time of the cinematic. Like the animation editor, I have it so that play the cinematic forwards, backwards, and frozen at a given time. My actions will store the initial values of the target objects so that it can restore it if the time is set to back before the action took place. This works great for all of the actions I have defined except an action to play a Unity Animation. I haven’t been able to find out how to look up the values that an
AnimationClip is going to modify, so I can’t store and restore the values themselves.

AnimationUtility.StartAnimationMode()
AnimationUtility.StopAnimationMode()

These functions would work, if it weren’t for the fact that a cinematic can play multiple animations at any given time, and StopAnimationMode can’t restore specific GameObjects only. What i’m looking for is something that can store GameObjects’ states and restore them interdependently from each other in any order.

Currently, I’m just creating a prefab via PrefabUtility and reverting the object to the prefab at will, but that causes a hiccup during Prefab creation and is a rather inelegant solution.

This is just a guess off the top of my head, and might not even be the “best” solution. But my first impression is that you could take a hint from the way networking in unity works:

When OnSerialize is called, your script serializes all it’s data into a stream.

When OnDeserialize is called, you retrieve that information from a stream that is passed to you and set your GameObject’s state.

This way you’re saving state every couple of frames (or every frame) and can return to whatever frame you need to in whatever order.

When it comes to actual code to give you; I have none at the moment. But I could find it.