Class Recorder
Inheritance
Inherited Members
Namespace: RecordAndPlay.Record
Assembly: RecordAndPlay.dll
Syntax
[CreateAssetMenu(menuName = "RecordAndPlay/Recorder")]
public class Recorder : ScriptableObject
Methods
AddOnRecordingCompleteCallback(UnityAction<Recording>)
Registers a callback to be invoked whenever the Finish() method is called.
Declaration
public void AddOnRecordingCompleteCallback(UnityAction<Recording> callback)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.Events.UnityAction<Recording> | callback | The callback to be executed |
BuildRecording()
Takes everything the recorder has seen so far and builds a recording from it, without stopping the recording process.
Declaration
public Recording BuildRecording()
Returns
| Type | Description |
|---|---|
| Recording | A recording representing everything we've seen up until this point in time. |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | Thrown when the recorder is stopped. |
CaptureCustomEvent(String, Dictionary<String, String>)
If you want to keep up with something special that occured at a certain time in your recording, then you can call this function with the details of the special event.
Declaration
public void CaptureCustomEvent(string name, Dictionary<string, string> contents)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Name of the event. |
| System.Collections.Generic.Dictionary<System.String, System.String> | contents | Details of the event. |
Remarks
Will be ignored if the recorder is currently paused.
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | Thrown when the recorder is stopped. |
CaptureCustomEvent(String, String)
If you want to keep up with something special that occured at a certain time in your recording, then you can call this function with the details of the special event.
Declaration
public void CaptureCustomEvent(string name, string contents)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Name of the event. |
| System.String | contents | Details of the event. |
Remarks
Will be ignored if the recorder is currently paused.
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | Thrown when the recorder is stopped. |
ClearMetadata()
Clears all meta data that has been set up to this point.
Declaration
public void ClearMetadata()
ClearSubjects()
Removes all registered subjects that where going to be recorded, removing any chance that their data will make it to the final recording.
Declaration
public void ClearSubjects()
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | Thrown when a recording is already in progress. |
CurrentlyPaused()
Whether or not the recorder is paused. When the recorder is paused, custom events logged will be ignored.
Declaration
public bool CurrentlyPaused()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the recerder is paused. |
CurrentlyRecording()
Whether or not we are accepting events occuring.
Declaration
public bool CurrentlyRecording()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if we are accepting events. |
CurrentlyStopped()
Whether or not the recorder has begun recording.
Declaration
public bool CurrentlyStopped()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if it has not started recording. |
CurrentState()
The current state the recorder is in.
Declaration
public RecordingState CurrentState()
Returns
| Type | Description |
|---|---|
| RecordingState | The current recorder state. |
Finish()
Stops the recorder and builds a recording for playback. Once a recorder is finished it is free to start making a whole new recording.
Declaration
public Recording Finish()
Returns
| Type | Description |
|---|---|
| Recording | A recording containing everything the recorder captured while not paused. |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | Thrown when the recorder is stopped. |
GetTimeProvider()
Declaration
public ITimeProvider GetTimeProvider()
Returns
| Type | Description |
|---|---|
| ITimeProvider |
Pause()
Moves the recorder state to be paused. Custom events that occur during this state are ignored.
Declaration
public void Pause()
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | Thrown when the recorder is not recording. |
Register(SubjectRecorder[])
Adds a Subject for the recorder to include when building recordings.
Declaration
public void Register(params SubjectRecorder[] subjectRecorder)
Parameters
| Type | Name | Description |
|---|---|---|
| SubjectRecorder[] | subjectRecorder | The subject to keep up with. |
Remarks
This function is already called by SubjectBehavior on Start. You shouldn't have to call this unless you called ClearSubjects() after the Start of the SubjectBehavior.
RemoveAllOnRecordingCompleteCallbacks()
Removes all callbacks from being called when Finish() is invoked
Declaration
public void RemoveAllOnRecordingCompleteCallbacks()
RemoveOnRecordingCompleteCallback(UnityAction<Recording>)
Removes a previously registered callback from being invoked when the Finish() method is called.
Declaration
public void RemoveOnRecordingCompleteCallback(UnityAction<Recording> callback)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.Events.UnityAction<Recording> | callback | The callback to be removed |
Resume()
Returns a recorder to a recording state if it was paused.
Declaration
public void Resume()
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | Thrown when the recorder is not paused. |
SetMetaData(String, String)
Set a key value pair for meta data.
Declaration
public void SetMetaData(string key, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | key | Dictionary Key. |
| System.String | value | Value. |
Start()
Starts recording the subjects.
Declaration
public void Start()
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | Thrown when a recording is already in progress. |
SubjectRecorders()
The different subjects to include in our recording.
Declaration
public List<SubjectRecorder> SubjectRecorders()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<SubjectRecorder> | The different subjects to include in our recording. |