using UnityEngine;
using UnityEditor.Experimental.Animations;
public class AnimatorTest : MonoBehaviour
{
public AnimationClip clip;
private GameObjectRecorder m_Recorder;
public int a;
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);
m_Recorder.BindComponentsOfType<dsf>(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);
}
}
}
image.png
网友评论