Version: 2021.1
言語: 日本語

GameObjectRecorder

class in UnityEditor.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 UnityEngine;
using UnityEditor.Animations;

public class RecordTransformHierarchy : 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<Transform>(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); } } }

変数

currentTimeReturns the current time of the recording. (Read Only)
isRecordingReturns true when the recorder is recording. (Read Only)
rootThe GameObject root of the animated hierarchy. (Read Only)

コンストラクタ

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 component.
BindComponentsOfTypeAdds 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 recorded animation to a destination clip.
TakeSnapshotForwards the animation by dt seconds, then record the values of the added bindings.

継承メンバー

変数

hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameオブジェクト名

Public 関数

GetInstanceIDGets the instance ID of the object.
ToStringReturns the name of the object.

Static 関数

DestroyRemoves a GameObject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindObjectOfTypeタイプ type から最初に見つけたアクティブのオブジェクトを返します
FindObjectsOfTypeGets a list of all loaded objects of Type type.
Instantiateoriginal のオブジェクトをクローンします

Operator

boolオブジェクトが存在するかどうか
operator !=二つのオブジェクトが異なるオブジェクトを参照しているか比較します
operator ==2つのオブジェクト参照が同じオブジェクトを参照しているか比較します。
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961