AR Foundation演示项目,使用 AR Foundation 4.1.7 并围绕某些功能演示更高级功能。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

53 行
1.1 KiB

using UnityEngine;
#if UNITY_EDITOR
using UnityEditor.Animations;
#endif
public class BodyEditorRecorder : MonoBehaviour
{
[SerializeField]
AnimationClip m_Clip;
bool m_Record = false;
BodyPlayback m_BodyPlayback;
#if UNITY_EDITOR
GameObjectRecorder m_Recorder;
void Start()
{
m_BodyPlayback = GetComponent<BodyPlayback>();
m_Recorder = new GameObjectRecorder(gameObject);
m_Recorder.BindComponentsOfType<Transform>(gameObject, true);
}
void LateUpdate()
{
if (m_Clip == null)
return;
if (m_Record)
{
m_Recorder.TakeSnapshot(1.0f/60.0f);
}
else if (m_Recorder.isRecording)
{
m_Recorder.SaveToClip(m_Clip);
m_Recorder.ResetRecording();
}
}
#endif
public void RecordToggle()
{
m_Record = !m_Record;
}
public void RecordClip()
{
m_Record = true;
m_BodyPlayback.PlayAnimationOneShot();
}
}