Class InputRecorder | Input System | 1.0.2
docs.unity3d.com
    Show / Hide Table of Contents

    Class InputRecorder

    A wrapper component around InputEventTrace that provides an easy interface for recording input from a GameObject.

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    InputRecorder
    Inherited Members
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(String, Single)
    MonoBehaviour.InvokeRepeating(String, Single, Single)
    MonoBehaviour.CancelInvoke(String)
    MonoBehaviour.IsInvoking(String)
    MonoBehaviour.StartCoroutine(String)
    MonoBehaviour.StartCoroutine(String, Object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(String)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(Object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, Component)
    Component.TryGetComponent<T>(T)
    Component.GetComponent(String)
    Component.GetComponentInChildren(Type, Boolean)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(Boolean)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, Boolean)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(Boolean)
    Component.GetComponentsInChildren<T>(Boolean, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, Boolean)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(Boolean)
    Component.GetComponentsInParent<T>(Boolean, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(String)
    Component.SendMessageUpwards(String, Object, SendMessageOptions)
    Component.SendMessageUpwards(String, Object)
    Component.SendMessageUpwards(String)
    Component.SendMessageUpwards(String, SendMessageOptions)
    Component.SendMessage(String, Object)
    Component.SendMessage(String)
    Component.SendMessage(String, Object, SendMessageOptions)
    Component.SendMessage(String, SendMessageOptions)
    Component.BroadcastMessage(String, Object, SendMessageOptions)
    Component.BroadcastMessage(String, Object)
    Component.BroadcastMessage(String)
    Component.BroadcastMessage(String, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(Object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, Boolean)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, Boolean)
    Object.Destroy(Object, Single)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, Boolean)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.DontDestroyOnLoad(Object)
    Object.FindObjectsOfType<T>()
    Object.FindObjectOfType<T>()
    Object.FindObjectOfType(Type)
    Object.ToString()
    Object.name
    Object.hideFlags
    Namespace: UnityEngine.InputSystem
    Syntax
    public class InputRecorder : MonoBehaviour
    Remarks

    This component comes with a custom inspector that provides an easy recording and playback interface and also gives feedback about what has been recorded in the trace. The interface also allows saving and loading event traces.

    Capturing can either be constrained by a devicePath or capture all input occuring in the system.

    Replay by default will happen frame by frame (see PlayAllFramesOneByOne()). If frame markers are disabled (see recordFrames), all events are queued right away in the first frame and replay completes immediately.

    Other than frame-by-frame, replay can be made to happen in a way that tries to simulate the original input timing. To do so, enable simulateOriginalTimingOnReplay. This will make use of PlayAllEventsAccordingToTimestamps()

    Properties

    allocatedSizeInBytes

    Total size of capture memory currently allocated.

    Declaration
    public long allocatedSizeInBytes { get; }
    Property Value
    Type Description
    Int64

    Size of memory allocated for capture.

    capture

    The underlying event trace that contains the captured input events.

    Declaration
    public InputEventTrace capture { get; }
    Property Value
    Type Description
    InputEventTrace

    Underlying event trace.

    Remarks

    This will be null if no capture is currently associated with the recorder.

    captureIsRunning

    Whether a capture is currently in progress.

    Declaration
    public bool captureIsRunning { get; }
    Property Value
    Type Description
    Boolean

    True if a capture is in progress.

    changeEvent

    Declaration
    public InputRecorder.ChangeEvent changeEvent { get; }
    Property Value
    Type Description
    InputRecorder.ChangeEvent

    devicePath

    Path that constrains the devices to record from.

    Declaration
    public string devicePath { get; set; }
    Property Value
    Type Description
    String

    Input control path to match devices or null/empty.

    Remarks

    By default, this is not set. Meaning that input will be recorded from all devices. By setting this property to a path, only events for devices that match the given path (as dictated by Matches(String, InputControl)) will be recorded from.

    By setting this property to the exact path of a device at runtime, recording can be restricted to just that device.

    See Also
    InputControlPath
    Matches(String, InputControl)

    eventCount

    Total number of events captured.

    Declaration
    public long eventCount { get; }
    Property Value
    Type Description
    Int64

    Number of captured events.

    playButtonPath

    Declaration
    public string playButtonPath { get; set; }
    Property Value
    Type Description
    String

    recordButtonPath

    Declaration
    public string recordButtonPath { get; set; }
    Property Value
    Type Description
    String

    recordFrames

    Whether to record frame marker events when capturing input. Enabled by default.

    Declaration
    public bool recordFrames { get; set; }
    Property Value
    Type Description
    Boolean

    True if frame marker events will be recorded.

    See Also
    recordFrameMarkers

    recordStateEventsOnly

    Whether to record only StateEvents and DeltaStateEvents. Disabled by default.

    Declaration
    public bool recordStateEventsOnly { get; set; }
    Property Value
    Type Description
    Boolean

    True if anything but state events should be ignored.

    replay

    The replay controller for when a replay is running.

    Declaration
    public InputEventTrace.ReplayController replay { get; }
    Property Value
    Type Description
    InputEventTrace.ReplayController

    Replay controller for the event trace while replay is running.

    See Also
    replayIsRunning
    StartReplay()

    replayIsRunning

    Whether a replay is currently being run by the component.

    Declaration
    public bool replayIsRunning { get; }
    Property Value
    Type Description
    Boolean

    True if replay is running.

    See Also
    replay
    StartReplay()
    StopReplay()

    replayOnNewDevices

    Whether a replay should create new devices or replay recorded events as is. Disabled by default.

    Declaration
    public bool replayOnNewDevices { get; set; }
    Property Value
    Type Description
    Boolean

    True if replay should temporary create new devices.

    See Also
    WithAllDevicesMappedToNewInstances()

    replayPosition

    Declaration
    public int replayPosition { get; }
    Property Value
    Type Description
    Int32

    simulateOriginalTimingOnReplay

    Whether to attempt to re-create the original event timing when replaying events. Disabled by default.

    Declaration
    public bool simulateOriginalTimingOnReplay { get; set; }
    Property Value
    Type Description
    Boolean

    If true, events are queued based on their timestamp rather than based on their recorded frames (if any).

    See Also
    PlayAllEventsAccordingToTimestamps()

    startRecordingWhenEnabled

    If true, input recording is started immediately when the component is enabled. Disabled by default. Call StartCapture() to manually start capturing.

    Declaration
    public bool startRecordingWhenEnabled { get; set; }
    Property Value
    Type Description
    Boolean

    True if component will start recording automatically in OnEnable().

    See Also
    StartCapture()

    totalEventSizeInBytes

    Total size of captured events.

    Declaration
    public long totalEventSizeInBytes { get; }
    Property Value
    Type Description
    Int64

    Size of captured events in bytes.

    Methods

    ClearCapture()

    Declaration
    public void ClearCapture()

    LoadCaptureFromFile(String)

    Declaration
    public void LoadCaptureFromFile(string fileName)
    Parameters
    Type Name Description
    String fileName

    OnDestroy()

    Declaration
    protected void OnDestroy()

    OnDisable()

    Declaration
    protected void OnDisable()

    OnEnable()

    Declaration
    protected void OnEnable()

    PauseReplay()

    Declaration
    public void PauseReplay()

    SaveCaptureToFile(String)

    Declaration
    public void SaveCaptureToFile(string fileName)
    Parameters
    Type Name Description
    String fileName

    StartCapture()

    Declaration
    public void StartCapture()

    StartReplay()

    Declaration
    public void StartReplay()

    StopCapture()

    Declaration
    public void StopCapture()

    StopReplay()

    Declaration
    public void StopReplay()
    In This Article
    • Properties
      • allocatedSizeInBytes
      • capture
      • captureIsRunning
      • changeEvent
      • devicePath
      • eventCount
      • playButtonPath
      • recordButtonPath
      • recordFrames
      • recordStateEventsOnly
      • replay
      • replayIsRunning
      • replayOnNewDevices
      • replayPosition
      • simulateOriginalTimingOnReplay
      • startRecordingWhenEnabled
      • totalEventSizeInBytes
    • Methods
      • ClearCapture()
      • LoadCaptureFromFile(String)
      • OnDestroy()
      • OnDisable()
      • OnEnable()
      • PauseReplay()
      • SaveCaptureToFile(String)
      • StartCapture()
      • StartReplay()
      • StopCapture()
      • StopReplay()
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023