how to save a value - like Transform or Rigidbody - not as a pointer, but just as it was in a given -moment-

Hey, so if we have an object

var theObject:Transform;

and it holds many children. and at a given moment in game we want to save it to other variable, like doing:

var object_snapShot:Transform = theObject;

it saves it as a "pointer"but we don't want a "pointer" - so that everytime we access "object_snapShot" we're really accessing "theObject".what we really want is a -save- of theObject at the moment of save.

example: if a cube is falling down the slope, it gains speed, it is rotating while bumping on rocks. we "snapShot" it. `var cube_snapShot:Transform = cube;` but what we want, later on - when the cube is already laying still, at the bottom of the slope - is to access the `cube_snapShot.position` - and see the position the cube had at the moment of snapshot. or `cube_snapShot.rotation`. or any other value, including the hierarchy of it's children (so that, yea, the "cube's Transform/GameObject" has just been saved there, at the moment of "snapshot").

Any help with that, please?

i would use a container class like this:

class TransformHolder extends System.ValueType
{
    var position : Vector3;
    var rotation : Quaternion;
    var scale : Vector3;

    function Store(t : Transform)
    {
        position = t.position;
        rotation = t.rotation;
        scale = t.scale;
    }

    function Set(t : Transform)
    {
        t.position = position;
        t.rotation = rotation;
        t.scale = scale;
    }
}

Then what you do is something like:

var object_snapShot:TransformHolder = new TransformHolder();

To store the snapshot:

object_snapShot.Store(transform);

To get the position from it:

var pos = object_snapShot.position;

To set all the data back to the Transform:

object_snapShot.Set(transform);

Thank you. that's basically what i was doing only it had a List to save it's transform properties cause the object I wish to save has a deep hierarchy, meaning I would probably need to save each of it's parts separately, if I can't just save the object's "Transform/GameObject" in one go.

class Snapshot{
var TR_position = new List.<Vector3>();
var TR_rotation = new List.<Quaternion>();

function Snapshot(object:Transform)
{
    writeTheProperties(object);
}

function writeTheProperties(object)
        for(var child in object){
                TR_position.Add(child.position);
                TR_rotation.Add(child.rotation);
            }

function returnProperties(object){
         //reverse
}

}

Does that seem correct?