# GameObjectRecorder

> Records the changing properties of a GameObject as the Scene runs and saves the information into an AnimationClip.

## Definition

* **Type:** Class
* **Namespace:** [UnityEditor.Animations](/engine/6000.3/script-reference/unityeditor/animations.md)
* **Assembly:** UnityEditor
* **Inherits from:** [Object](/engine/6000.3/script-reference/unityengine/object.md)

```csharp
public class GameObjectRecorder : Object
```

## Remarks

This class binds [GameObject](/engine/6000.3/script-reference/unityengine/gameobject.md) properties, records their values as they change in the running Scene, and saves the result in an [AnimationClip](/engine/6000.3/script-reference/unityengine/animationclip.md). The recorded GameObject is called [GameObjectRecorder.root](/engine/6000.3/script-reference/unityeditor/animations/gameobjectrecorder/root.md) in the class, and you can also bind the properties of any child of [GameObjectRecorder.root](/engine/6000.3/script-reference/unityeditor/animations/gameobjectrecorder/root.md).

See the following code example on how this class can be implemented and to set what gets recorded.

## Examples

```csharp
using UnityEngine;
using UnityEditor.Animations;

public class RecordTransformHierarchy : MonoBehaviour
{
    public AnimationClip clip;

    private GameObjectRecorder m_Recorder;

    void Start()
    {
        // Create recorder and record the script GameObject.
        m_Recorder = new GameObjectRecorder(gameObject);

        // Bind all the Transforms on the GameObject and all its children.
        m_Recorder.BindComponentsOfType<Transform>(gameObject, true);
    }

    void LateUpdate()
    {
        if (clip == null)
            return;

        // Take a snapshot and record all the bindings values for this frame.
        m_Recorder.TakeSnapshot(Time.deltaTime);
    }

    void OnDisable()
    {
        if (clip == null)
            return;

        if (m_Recorder.isRecording)
        {
            // Save the recorded session to the clip.
            m_Recorder.SaveToClip(clip);
        }
    }
}
```

## Constructors

| Constructor                                                                                                                     | Description                      |
| ------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
| [GameObjectRecorder(UnityEngine.GameObject)](/engine/6000.3/script-reference/unityeditor/animations/gameobjectrecorder/ctor.md) | Create a new GameObjectRecorder. |

## Properties

| Property                                                                                                | Description                                                                                                             |
| ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| [currentTime](/engine/6000.3/script-reference/unityeditor/animations/gameobjectrecorder/currenttime.md) | Returns the current time of the recording. (Read Only)                                                                  |
| [isRecording](/engine/6000.3/script-reference/unityeditor/animations/gameobjectrecorder/isrecording.md) | Returns true when the recorder is recording. (Read Only)                                                                |
| [root](/engine/6000.3/script-reference/unityeditor/animations/gameobjectrecorder/root.md)               | The [GameObject](/engine/6000.3/script-reference/unityengine/gameobject.md) root of the animated hierarchy. (Read Only) |

## Methods

| Method                                                                                                                    | Description                                                                                                                                                           |
| ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Bind](/engine/6000.3/script-reference/unityeditor/animations/gameobjectrecorder/bind.md)                                 | Binds a GameObject's property as defined by [EditorCurveBinding](/engine/6000.3/script-reference/unityeditor/editorcurvebinding.md).                                  |
| [BindAll](/engine/6000.3/script-reference/unityeditor/animations/gameobjectrecorder/bindall.md)                           | Adds bindings for all of **target**'s properties, and also for all the **target**'s children if **recursive** is `true`.                                              |
| [BindComponent](/engine/6000.3/script-reference/unityeditor/animations/gameobjectrecorder/bindcomponent.md)               | Adds bindings for all the properties of **component**.                                                                                                                |
| [BindComponentsOfType](/engine/6000.3/script-reference/unityeditor/animations/gameobjectrecorder/bindcomponentsoftype.md) | Adds bindings for all the properties of the first component of type **T** found in **target**, and also for all the **target**'s children if **recursive** is `true`. |
| [GetBindings](/engine/6000.3/script-reference/unityeditor/animations/gameobjectrecorder/getbindings.md)                   | Returns an array of all the bindings added to the recorder.                                                                                                           |
| [ResetRecording](/engine/6000.3/script-reference/unityeditor/animations/gameobjectrecorder/resetrecording.md)             | Reset the recording.                                                                                                                                                  |
| [SaveToClip](/engine/6000.3/script-reference/unityeditor/animations/gameobjectrecorder/savetoclip.md)                     | Saves recorded animation to a destination clip.                                                                                                                       |
| [TakeSnapshot](/engine/6000.3/script-reference/unityeditor/animations/gameobjectrecorder/takesnapshot.md)                 | Forwards the animation by **dt** seconds, then record the values of the added bindings.                                                                               |

## Inheritance

**Inherited Members:**

* [Object.GetInstanceID()](/engine/6000.3/script-reference/unityengine/object/getinstanceid.md)
* [Object.GetHashCode()](/engine/6000.3/script-reference/unityengine/object/gethashcode.md)
* [Object.InstantiateAsync\<T>(T)](/engine/6000.3/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, Transform)](/engine/6000.3/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, Vector3, Quaternion)](/engine/6000.3/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, Transform, Vector3, Quaternion)](/engine/6000.3/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int)](/engine/6000.3/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Transform)](/engine/6000.3/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Vector3, Quaternion)](/engine/6000.3/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, ReadOnlySpan\<Vector3>, ReadOnlySpan\<Quaternion>)](/engine/6000.3/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Transform, Vector3, Quaternion)](/engine/6000.3/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Transform, Vector3, Quaternion, CancellationToken)](/engine/6000.3/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Transform, ReadOnlySpan\<Vector3>, ReadOnlySpan\<Quaternion>)](/engine/6000.3/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Transform, ReadOnlySpan\<Vector3>, ReadOnlySpan\<Quaternion>, CancellationToken)](/engine/6000.3/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, InstantiateParameters, CancellationToken)](/engine/6000.3/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, InstantiateParameters, CancellationToken)](/engine/6000.3/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, Vector3, Quaternion, InstantiateParameters, CancellationToken)](/engine/6000.3/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Vector3, Quaternion, InstantiateParameters, CancellationToken)](/engine/6000.3/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, ReadOnlySpan\<Vector3>, ReadOnlySpan\<Quaternion>, InstantiateParameters, CancellationToken)](/engine/6000.3/script-reference/unityengine/object/instantiateasync.md)
* [Object.Instantiate(Object, Vector3, Quaternion)](/engine/6000.3/script-reference/unityengine/object/instantiate.md#instantiate\(object-vector3-quaternion\))
* [Object.Instantiate(Object, Vector3, Quaternion, Transform)](/engine/6000.3/script-reference/unityengine/object/instantiate.md#instantiate\(object-vector3-quaternion-transform\))
* [Object.Instantiate(Object)](/engine/6000.3/script-reference/unityengine/object/instantiate.md#instantiate\(object\))
* [Object.Instantiate(Object, Scene)](/engine/6000.3/script-reference/unityengine/object/instantiate.md#instantiate\(object-scene\))
* [Object.Instantiate\<T>(T, InstantiateParameters)](/engine/6000.3/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate\<T>(T, Vector3, Quaternion, InstantiateParameters)](/engine/6000.3/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate(Object, Transform)](/engine/6000.3/script-reference/unityengine/object/instantiate.md#instantiate\(object-transform\))
* [Object.Instantiate(Object, Transform, bool)](/engine/6000.3/script-reference/unityengine/object/instantiate.md#instantiate\(object-transform-bool\))
* [Object.Instantiate\<T>(T)](/engine/6000.3/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate\<T>(T, Vector3, Quaternion)](/engine/6000.3/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate\<T>(T, Vector3, Quaternion, Transform)](/engine/6000.3/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate\<T>(T, Transform)](/engine/6000.3/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate\<T>(T, Transform, bool)](/engine/6000.3/script-reference/unityengine/object/instantiate.md)
* [Object.Destroy(Object, float)](/engine/6000.3/script-reference/unityengine/object/destroy.md)
* [Object.DestroyImmediate(Object, bool)](/engine/6000.3/script-reference/unityengine/object/destroyimmediate.md)
* [Object.FindObjectsByType(Type, FindObjectsSortMode)](/engine/6000.3/script-reference/unityengine/object/findobjectsbytype.md#findobjectsbytype\(type-findobjectssortmode\))
* [Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)](/engine/6000.3/script-reference/unityengine/object/findobjectsbytype.md#findobjectsbytype\(type-findobjectsinactive-findobjectssortmode\))
* [Object.DontDestroyOnLoad(Object)](/engine/6000.3/script-reference/unityengine/object/dontdestroyonload.md)
* [Object.FindObjectsByType\<T>(FindObjectsSortMode)](/engine/6000.3/script-reference/unityengine/object/findobjectsbytype.md#findobjectsbytypet\(findobjectssortmode\))
* [Object.FindObjectsByType\<T>(FindObjectsInactive, FindObjectsSortMode)](/engine/6000.3/script-reference/unityengine/object/findobjectsbytype.md#findobjectsbytypet\(findobjectsinactive-findobjectssortmode\))
* [Object.FindFirstObjectByType\<T>()](/engine/6000.3/script-reference/unityengine/object/findfirstobjectbytype.md#findfirstobjectbytypet\(\))
* [Object.FindAnyObjectByType\<T>()](/engine/6000.3/script-reference/unityengine/object/findanyobjectbytype.md#findanyobjectbytypet\(\))
* [Object.FindFirstObjectByType\<T>(FindObjectsInactive)](/engine/6000.3/script-reference/unityengine/object/findfirstobjectbytype.md#findfirstobjectbytypet\(findobjectsinactive\))
* [Object.FindAnyObjectByType\<T>(FindObjectsInactive)](/engine/6000.3/script-reference/unityengine/object/findanyobjectbytype.md#findanyobjectbytypet\(findobjectsinactive\))
* [Object.FindFirstObjectByType(Type)](/engine/6000.3/script-reference/unityengine/object/findfirstobjectbytype.md#findfirstobjectbytype\(type\))
* [Object.FindAnyObjectByType(Type)](/engine/6000.3/script-reference/unityengine/object/findanyobjectbytype.md#findanyobjectbytype\(type\))
* [Object.FindFirstObjectByType(Type, FindObjectsInactive)](/engine/6000.3/script-reference/unityengine/object/findfirstobjectbytype.md#findfirstobjectbytype\(type-findobjectsinactive\))
* [Object.FindAnyObjectByType(Type, FindObjectsInactive)](/engine/6000.3/script-reference/unityengine/object/findanyobjectbytype.md#findanyobjectbytype\(type-findobjectsinactive\))
* [Object.ToString()](/engine/6000.3/script-reference/unityengine/object/tostring.md)
* [Object.name](/engine/6000.3/script-reference/unityengine/object/name.md)
* [Object.hideFlags](/engine/6000.3/script-reference/unityengine/object/hideflags.md)

### Operators

| Operator                                                                           | Description                                                             |
| ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| [operator ==](/engine/6000.3/script-reference/unityengine/object/op-equality.md)   | Compares two object references to see if they refer to the same object. |
| [bool](/engine/6000.3/script-reference/unityengine/object/op-implicit.md)          | Determines whether the object exists.                                   |
| [operator !=](/engine/6000.3/script-reference/unityengine/object/op-inequality.md) | Compares if two objects refer to a different object.                    |
