Version: 2017.1
Experimental: this API is experimental and might be changed or removed in the future.

GameObjectRecorder

class in UnityEditor.Experimental.Animations

/

継承:Object

マニュアルに切り替える

説明

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

This class binds GameObject properties, records their values as they change in the running Scene, and saves the result in an AnimationClip. The recorded GameObject is called root in the class, and you can also bind the properties of any child of root.

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

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditor.Experimental.Animations;

public class RecordTransformHierarchy : MonoBehaviour { public AnimationClip clip; public bool record = false;

private GameObjectRecorder m_Recorder;

void Start() { m_Recorder = new GameObjectRecorder(); m_Recorder.root = gameObject;

m_Recorder.BindComponent<Transform>(gameObject, true); }

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

if (record) { m_Recorder.TakeSnapshot(Time.deltaTime); } else if (m_Recorder.isRecording) { m_Recorder.SaveToClip(clip); m_Recorder.ResetRecording(); } } }

変数

currentTimeReturns the current time of the recording.
isRecordingReturns true when the recorder is recording.
rootThe GameObject used for the recording.

コンストラクタ

GameObjectRecorderCreate a new GameObjectRecorder.

Public 関数

BindBinds a GameObject's property as defined by EditorCurveBinding.
BindAllAdds bindings for all of target's properties, and also for all the target's children if recursive is true.
BindComponentAdds 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.
GetBindingsReturns an array of all the bindings added to the recorder.
ResetRecordingReset the recording.
SaveToClipSaves the recorded animation into clip.
TakeSnapshotForwards the animation by dt seconds, then record the values of the added bindings.

継承メンバー

変数

hideFlagsオブジェクトは非表示、シーンに保存、ユーザーが編集可能、などを設定する。
nameオブジェクト名

Public 関数

GetInstanceIDオブジェクトのインスタンス ID を返します
ToStringゲームオブジェクトの名前を返します

Static 関数

Destroyゲームオブジェクトやコンポーネント、アセットを削除します
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoad新しいシーンを読み込んでもオブジェクトが自動で破壊されないように設定します
FindObjectOfTypeタイプ type から最初に見つけたアクティブのオブジェクトを返します
FindObjectsOfTypeタイプから見つけたすべてのアクティブのオブジェクト配列を返します
Instantiateoriginal のオブジェクトをクローンします

Operator

boolオブジェクトが存在するかどうか
operator !=二つのオブジェクトが異なるオブジェクトを参照しているか比較します
operator ==2つのオブジェクト参照が同じオブジェクトを参照しているか比較します。