docs.unity3d.com

    Recorded Playback

    This package enables users to create and run recorded playbacks (recordings) of a Unity project.

    Integration

    Add the RecordingInputModule provided in the package to a Game Object in the first scene that will be part of your recording. If you would like recordings to span multiple scenes, make sure the GameObject that the RecordingInputModule is attached to will continue to exist throughout the recording. A simple way to ensure this is to attach a script to that GameObject with DontDestroyOnLoad(this.gameObject); in the Awake() method.

    Known Limitations

    • Game objects included in recordings must have a unique combination of name and tags in the scene at the time they are interacted with.
    • Only touch, click, and drag actions are recorded, we do not yet support keyboard input.
    • Native device interactions such as phone keyboards or purchase confirmations are not currently supported.

    Recording and Playback

    Open up the Recorded Playback window (Window -> Recorded Playback) to find the record button as well as a list of all recordings that are in the project's Assets/Recordings folder. New recordings are automatically put into this folder.

    Recording Files

    Recordings are saved to the Assets/Recordings folder and named recording-[timestamp].json. Recordings are stored as json files containing a timestamped list of touch data on Game Objects - each defined by its name and tags.

    Recording Data Scheme

    parameter name type
    position vector 2
    eventType integer, eventType enumeration
    timeSinceStart number
    pointerId integer
    waitSignal string
    emitSignal string
    objectName string
    objectTag string
    eventType meaning
    0 non-interaction, used for signals
    1 pointer down
    2 pointer up

    If waitSignal is specified and non-empty, playback halts until the RecordingInputModule is provided the specified signal through the SendSignal(string signal) function (included in RecordingInputModule.cs).

    If emitSignal is specified and non-empty, RecordingInputModule will invoke the callback UnityEvent with the provided string parameter.

    example file:

    {
       "touchData" : [
          {
             "position" : {
                "y" : 0.508287310600281,
                "x" : 0.457231730222702
             },
             "eventType" : 1,
             "timeSinceStart" : 0.582690715789795,
             "pointerId" : -1,
             "waitSignal" : "",
             "emitSignal": "",
             "objectName": "MenuButton",
             "objectTag": "Untagged"
          },
          {
             "waitSignal" : "",
             "pointerId" : -1,
             "position" : {
                "y" : 0.508287310600281,
                "x" : 0.457231730222702
             },
             "timeSinceStart" : 1.04915285110474,
             "eventType" : 2,
             "emitSignal": "",
             "objectName": "MenuButton",
             "objectTag": "Untagged"
          },
          {
             "eventType": 0,
             "timeSinceStart" : 1.05,
             "waitSignal": "continue",
             "emitSignal": ""
          },
          {
             "eventType": 0,
             "timeSinceStart": 5,
             "waitSignal" : "",
             "emitSignal": "done"
          }
       ]
    }
    

    Attaching Recordings to Unity Tests

    See Recorded Testing.

    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