ReplayManager Class

Ultimate Replay

ReplayManager Class
The main interface for Ultimate Replay and allows full control over object recording and playback.
Inheritance Hierarchy
SystemObject  Object
    Component
      Behaviour
        MonoBehaviour
          UltimateReplay.UtilMonoSingletonReplayManager
            UltimateReplayReplayManager

Namespace: UltimateReplay
Assembly: UltimateReplay (in UltimateReplay.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public sealed class ReplayManager : MonoSingleton<ReplayManager>

The ReplayManager type exposes the following members.

Constructors
  NameDescription
Public methodReplayManager
Initializes a new instance of the ReplayManager class
Top
Methods
  NameDescription
Public methodStatic memberBeginPlayback
Use this method to begin the playback of the recorded objects. Use SetPlaybackFrame(Single, PlaybackOrigin) or SetPlaybackFrameNormalized(Single, PlaybackOrigin) before calling this method to specify the exact location at which playback should begin. This method will run the entire playback gathered and then automatically stop playback on completion if endReplayAfterPlayback is true.
Public methodStatic memberBeginPlaybackFrame
Use this method to set the current playback at a specific replay frame. This will allow the state of a specific replay frame to be restored but will not continue playback which will provide a freeze frame effect. Use SetPlaybackFrame(Single, PlaybackOrigin) or SetPlaybackFrameNormalized(Single, PlaybackOrigin) before calling this method to specify the exact location at which the playback frame should be sampled. Use StopPlayback to unfreeze the still frame and return to normal game mode. This method will ignore the value of endReplayAfterPlayback as only a single frame is replayed. As a result you will need to call StopPlayback when you want to end the playback frame.
Public methodStatic memberBeginRecording
Use this method to begin sampling the recorded objects in the scene. If recordOnStart is true then this method will be called automatically when the manager is initialized. Any state information will be recored via the assigned ReplayTarget (Default ReplayMemoryTarget). When true, any previous recording data will be discarded
Public methodStatic memberDiscardRecording
This method will throw away any recorded data and flush the replay target if necessary. This method can be called at any time. If the manager is currently recording then all previous data will be discarded and recording will continue. If the manager is currently replaying then all replay data will be discarded and playback will stop.
Public methodStatic memberFindReplayPrefab
Attempts to find the prefab with the matching name. This is used to restore objects that were destroyed during recording.
Public methodStatic memberForceAwake
Override implementation of ForceAwake. Performs exactly the same behaviour. Simply included so that the user does not need to import 'UltimateReplay.Util' to access the method.
Public methodOnDestroy
Called by Unity. Allows the active replay manager to cleanup any active recordings.
Public methodOnLevelWasLoaded
Called by Unity. Allows the active replay manager to cleanup recordings when a scene change is made.
Public methodOnValidate
Called by Unity.
Public methodStatic memberPausePlayback
Use this method to pause replay playback while maintinaing the current replay state. See ResumePlayback to continue a playback.
Public methodStatic memberPauseRecording
Use this method when you want to pause recording but may continue recording at any point. A good candidate for pausing recording is when the user pauses the game and is shown a pause menu. The manager must already be recording otherwise this method will have no effect.
Public methodStatic memberRegisterReplayPrefab
Attempts to register a game object as a prefab so that the replay system is able to spawn or despawn the object as needed. You only need to do this for objects that are likley to be either instantiated or destroyed during recording. The replay system will then be able to accuratley restore the scene state during playback. The specified object must be a prefab otherwise an error will be thrown and the object will not be registered. Prefab instances are not accepted.
Public methodStatic memberReplayDestroy
Attempts to destroy the specified prefab. OnReplayDestroy will be called if a listener has been registered otherwise default destruction will be used.
Public methodStatic memberReplayInstantiate
Attempts to instantiate the specified prefab. OnReplayInstantiate will be called if a listener has been registered otherwise default instantiation will be used.
Public methodStatic memberResumePlayback
Use this method to resume playback after a previous call to PausePlayback was called. If PausePlayback was not called prior to this method then the method will have no effect.
Public methodStatic memberResumeRecording
Use this method to resume recording after a previous call to PauseRecording. The manager must already be recording otherwise this method will have no effect.
Public methodStatic memberSetPlaybackFrame
Use this method to specify where in the replay sequence the playback should start. If the offset does not lie within the bounds of the replay then the value will be clamped to represent either the start or end frame.
Public methodStatic memberSetPlaybackFrameNormalized
Use this method to specify where in the replay sequence the playback should start. This method accepts normalized offsets values between 0 and 1 and performs validation before using the value.
Public methodStart
Called by Unity. Allows the active replay manager to initialize.
Public methodStatic memberStopPlayback
Use this method to stop any active playback. This method will only have an effect if there is an active playback running otherwise it will have no effect.
Public methodStatic memberStopRecording
Use this method to stop recording after a previous call to BeginRecording(Boolean). The manager must already be recording otherwise this method will have no effect. This method must be called before attempting to playback otherwise you may get unpredicatable results.
Public methodUpdate
Called by Unity. Allows the active replay manager to update recoring or playback.
Top
Fields
  NameDescription
Public fieldendReplayAfterPlayback
When true, the replay manager will automatically restore the previous game state after playback has finished. When false, playback will continue to loop forever until a suitable stop or pause command is issued manually.
Public fieldStatic memberOnReplayDestroy
Called by the replay system whenever it needs to destroy a game object in order to restore a previous scene state. You can add a listener to override the default behaviour which can be useful if you want to handle the destruction manually for purposes such as object pooling.
Public fieldStatic memberOnReplayInstantiate
Called by the replay system whenever it needs to instantiate a prefab for use during playback. You can add a listener to override the default behaviour which can be useful if you want to handle the instantiation manually for purposes such as object pooling.
Public fieldprefabs
A collection of prefabs that may be spawned or destroyed during recording and as a result amy need to be spawned or destroyed in order to accuratley recreate the replay.
Public fieldrecordFPS
The target record framerate of the sampler. The higher this value the higher the memory consumption and cpu usage will be. You will need to fine tune this value to tradeoff performance or memory usage for replay accuracy.
Public fieldrecordOnStart
When true, the manager will automatically begin recording the scene one it is initialized.
Top
Properties
  NameDescription
Public propertyStatic memberCurrentPlaybackTime
Get the current playback time in seconds. This value will never be greater than duration.
Public propertyStatic memberCurrentPlaybackTimeNormalized
Get the current playback time as a normalized value between 0-1. 0 represents the starting frame of the recording and 1 represents the very last frame of the recording.
Public propertyStatic memberIsPaused
Returns true when the active replay manager is in any paused state. Paused states could include Playback_Paused or Recording_Paused.
Public propertyStatic memberIsRecording
Returns true if the manager is currently recording the scene. Note: If recording is paused this value will still be true.
Public propertyStatic memberIsReplaying
Returns true if the manager is currently playing back previously recorded replay data. Note: if playback is paused this value will still be true.
Public propertyStatic memberPlaybackDirection
Gets the current PlaybackDirection of replay playback.
Public propertyStatic memberPreparer
Access the current IReplayPreparer that the active replay manager will use to prepare game objects for replay. By default a DefaultReplayPreparer is used.
Public propertyStatic memberReplay
Get the active replay manager in the scene. If no replay manager could be found then one will be created with default settings. This property may be null in a rare case where the active replay manager was destroyed in the same frame as an application quit event was issued. In this situation the replay manager cannot be recreated as it would cause leaked objects.
Public propertyStatic memberScene
Get the ReplayScene associated with the replay system.
Public propertyStatic memberTarget
The current replay target that is being used to store the replay data. By default, the replay target is ReplayMemoryTarget.
Top
See Also