Class Recording
A collection of different events and objects that where captured with a recorder.
Inheritance
Implements
Inherited Members
Namespace: RecordAndPlay
Assembly: RecordAndPlay.dll
Syntax
[Serializable]
public class Recording : ScriptableObject, ISerializationCallbackReceiver
Remarks
This is a Scriptable Object, so to create it you should call the static method Recording.CreateInstance(). However, creation of recordings is probably best left up to the Recorder object.
If you wish to save this recording to the projects assets for ease of playback in the editor, then look into SaveToAssets. Doing this will create a recording object in your assets folder that can be viewed directly in the editor, or can used as a variable in the inspector of some script.
If you wish to save the recording efficiently to disk for purposes such as saving memory or transmitting over the web, look into the Packager class.
Properties
CapturedCustomEvents
All custom events global to the recording.
Declaration
public CustomEventCapture[] CapturedCustomEvents { get; }
Property Value
Type | Description |
---|---|
CustomEventCapture[] |
Metadata
Global key value pairs with no associated timestamp.
Declaration
public Dictionary<string, string> Metadata { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.String> |
RecordingName
The name of the recording/scriptable object asset
Declaration
public string RecordingName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
SubjectRecordings
All objects whose positions and rotations where recorded in the scene.
Declaration
public SubjectRecording[] SubjectRecordings { get; }
Property Value
Type | Description |
---|---|
SubjectRecording[] |
Methods
BuildActors(IActorBuilder, Transform)
Builds actors meant to act out the recorded objects and what they did.
Declaration
public ActorPlaybackControl[] BuildActors(IActorBuilder actorBuilder, Transform parent)
Parameters
Type | Name | Description |
---|---|---|
IActorBuilder | actorBuilder | What will take the subject data and return us actors for playback. |
UnityEngine.Transform | parent | What all created actors will be parented to. |
Returns
Type | Description |
---|---|
ActorPlaybackControl[] | Controls for controlling the playback of each individual actor. |
Remarks
If the actorBuilder is null then cubes will be used to represent the subject. If an actorBuilder is supplied but they supply a null Actor, then that subject will be excluded from the playback. It' generally best to not call this method directly, but use an instance of PlaybackBehavior to call this method for you and manage all the actors.
CreateInstance(SubjectRecording[], CustomEventCapture[], Dictionary<String, String>)
Acts as the constructor of the recording class since it inherits from ScriptableObject.
Declaration
public static Recording CreateInstance(SubjectRecording[] subjectRecordings, CustomEventCapture[] capturedCustomEvents, Dictionary<string, string> metadata)
Parameters
Type | Name | Description |
---|---|---|
SubjectRecording[] | subjectRecordings | The different subjects that whose position and rotation where recorded. |
CustomEventCapture[] | capturedCustomEvents | Different global custom events that occured during capture. |
System.Collections.Generic.Dictionary<System.String, System.String> | metadata | Global key value pairs with no associated timestamp. |
Returns
Type | Description |
---|---|
Recording | A Recording that can be used for playback. |
GetDuration()
Gets the duration of the recording by comparing the timestamps of the first and last captured events.
Declaration
public float GetDuration()
Returns
Type | Description |
---|---|
System.Single | The duration of the recording. |
GetStartTime()
The first event of a recording does not have to occur at timestamp 0. This method calculates and caches the time of the first event captured in the recording.
Declaration
public float GetStartTime()
Returns
Type | Description |
---|---|
System.Single | The time of the first event captured. |
OnAfterDeserialize()
Used for custom Unity serialization. Do not call this method.
Declaration
public void OnAfterDeserialize()
OnBeforeSerialize()
Used for custom Unity serialization. Do not call this method.
Declaration
public void OnBeforeSerialize()
SaveToAssets(String)
Saves the recording as an asset to the root of the asset folder of the project. Editor Only
Declaration
[Obsolete("SaveToAssets is an editor only method and does nothing once built.")]
public void SaveToAssets(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the asset. |
Remarks
Will append a number to the end of the name if another asset already uses the name passed in.
SaveToAssets(String, String)
Saves the recording as an asset to the asset folder of the project. Editor Only
Declaration
[Obsolete("SaveToAssets is an editor only method and does nothing once built.")]
public void SaveToAssets(string name, string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the asset. |
System.String | path | Where in the project for the asset to be saved. |
Remarks
Will append a number to the end of the name if another asset already uses the name passed in.
ToCSV()
Builds a CSV representation of the data contained within the recording.
Declaration
public CSVPage[] ToCSV()
Returns
Type | Description |
---|---|
CSVPage[] | CSV representation of the data contained within the recording |
ToJSON()
Converts the Recording to a json formatted string.
Declaration
public string ToJSON()
Returns
Type | Description |
---|---|
System.String | Json formatted String. |