using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEditor; using UnityEditor.Animations; public class record : 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(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); } } }