录制动画 保存到 animationclip
作者:
杰罗xr | 来源:发表于
2020-03-11 10:04 被阅读0次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
本文标题:录制动画 保存到 animationclip
本文链接:https://www.haomeiwen.com/subject/nnofvctx.html
网友评论