Class SubjectRecording
A recording with information pertaining to a single subject.
Inheritance
Implements
Inherited Members
Namespace: RecordAndPlay
Assembly: RecordAndPlay.dll
Syntax
[Serializable]
public class SubjectRecording : ISerializationCallbackReceiver
Remarks
The number of captured positions does not have to match the number of captured rotations. The recorder is smart and aims to only capture changes in velocity of position and rotation. So even if the recorder is set to capture the subject's position 30 times a second and runs for 5 seconds, if the subject is moving in a straight line, then only 2 captures are kept to represent that line.
Constructors
SubjectRecording(Int32, String, Dictionary<String, String>, VectorCapture[], VectorCapture[], UnityLifeCycleEventCapture[], CustomEventCapture[])
Creates a new subject recording
Declaration
public SubjectRecording(int subjectID, string subjectName, Dictionary<string, string> metadata, VectorCapture[] capturedPositions, VectorCapture[] capturedRotations, UnityLifeCycleEventCapture[] capturedLifeCycleEvents, CustomEventCapture[] capturedCustomActorEvents)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | subjectID | Unique identifier for the subject in a recording. |
System.String | subjectName | Name to refer to in the recording. |
System.Collections.Generic.Dictionary<System.String, System.String> | metadata | Custom key value pairs. |
VectorCapture[] | capturedPositions | Captured positions. |
VectorCapture[] | capturedRotations | Captured rotations. |
UnityLifeCycleEventCapture[] | capturedLifeCycleEvents | All lifecycle events that occured during the recording. |
CustomEventCapture[] | capturedCustomActorEvents | Custom key value pairs with associated time stamps. |
Properties
CapturedCustomEvents
All custom events that only happened to this specific subject specifically.
Declaration
public CustomEventCapture[] CapturedCustomEvents { get; }
Property Value
Type | Description |
---|---|
CustomEventCapture[] |
CapturedLifeCycleEvents
All lifecycle events that occured to the subject during a recording.
Declaration
public UnityLifeCycleEventCapture[] CapturedLifeCycleEvents { get; }
Property Value
Type | Description |
---|---|
UnityLifeCycleEventCapture[] |
Remarks
If a start event does not exist, that means the subject existsed before the recording started. An absence of a death event means that the subject was not destroyed while being recorded.
CapturedPositions
All captured positions.
Declaration
public VectorCapture[] CapturedPositions { get; }
Property Value
Type | Description |
---|---|
VectorCapture[] |
CapturedRotations
All captured rotations.
Declaration
public VectorCapture[] CapturedRotations { get; }
Property Value
Type | Description |
---|---|
VectorCapture[] |
Metadata
Key value pairs with no associated timestamp specific to the subject
Declaration
public Dictionary<string, string> Metadata { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.String> |
SubjectID
Refers to the unity object's instance ID. Guaranteed to be unique within a single recording.
Declaration
public int SubjectID { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
SubjectName
The gameobject's name unless specified.
Declaration
public string SubjectName { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
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. |
GetEndingPosition()
The last recorded position made by the recorder.
Declaration
public Vector3 GetEndingPosition()
Returns
Type | Description |
---|---|
UnityEngine.Vector3 | Last recorded position. |
GetEndingRotation()
The last recorded rotation made by the recorder.
Declaration
public Quaternion GetEndingRotation()
Returns
Type | Description |
---|---|
UnityEngine.Quaternion | Last recorded rotation. |
GetEndTime()
The last event within the recording.
Declaration
public float GetEndTime()
Returns
Type | Description |
---|---|
System.Single | The time of the last event captured. |
GetStartingPosition()
The first ever recorded position made by the recorder.
Declaration
public Vector3 GetStartingPosition()
Returns
Type | Description |
---|---|
UnityEngine.Vector3 | First ever recorded position. |
GetStartingRotation()
The first ever recorded rotation made by the recorder.
Declaration
public Quaternion GetStartingRotation()
Returns
Type | Description |
---|---|
UnityEngine.Quaternion | First ever recorded rotation. |
GetStartTime()
The first event of a recording does not have to occur at timestamp 0.
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()
ToJSON()
Converts the Subject Recording to a json formatted string.
Declaration
public string ToJSON()
Returns
Type | Description |
---|---|
System.String | Json formatted String. |