datagatherer - eisclimber/ExPresS-XR GitHub Wiki

DataGatherer

Class in ExPresSXR.Experimentation.DataGathering

Inherits from UnityEngine.MonoBehaviour

Summary

The Data Gatherer is a component to extract and save data in a Unity Scene. All values that are specified in the Data Gatherer will be stored in a CSV-formatted file which will be saved at the path and/or be send via http POST to a server.

A more detailed description of the capabilities of the Data Gatherer can be found in the DataGathering-Tutorial which is also available in the editor under "ExPresS XR > Data Gathering".

Some important things to note:

  • The DataGatherer can automatically export values but any script can export new values at any time callingExportNewCsvLine().
  • When played in the editor the Values will be stored at Application.dataPath. The Build will store it at the apps data-path (e.g. %APPDATA% on Windows)
  • While includeTimestamp is optional it is recommended to include it as the export times might differ by a few milliseconds.
  • The shortest somewhat stable value for periodicExportTime was about 0.01s.
  • Using exportDuringUpdate the exports were around 0.02 on a Valve Index (aprox. Time.DeltaTime with 60FPs).
public class DataGatherer : MonoBehaviour

Enums

Name Description
ExportType How data is exported.
SeparatorType Type of separating csv columns.

Fields

Name Description
DEFAULT_EXPORT_FILE_ENDING Default file ending used if a path does not provide a file extension considered valid.
DEFAULT_EXPORT_FILE_NAME Default path to the export file created to safe the data.
DELTA_TIME_COLUMN_NAME Name of the automatically generated delta time (duration of current frame) column.
EXPORT_FILE_ENDINGS File endings considered valid log file paths. If the files do not match one of these endings, s
HUMAN_READABLE_TIME_COLUMN_NAME Name of the automatically generated timestamp (number) column.
timestampPretty Format for a pretty timestamp with a space separating date and time.
timestampSafe Format for a safe timestamp with a underscore separating date and time.
UNITY_TIME_COLUMN_NAME Name of the automatically generated unitx time (seconds since app start) column.
UNIX_TIME_COLUMN_NAME Name of the automatically generated unix timestamp (date + time in UTC) column.

Methods

Name Description
AddNewBinding(DataGatheringBinding) Adds a DataGatheringBinding to the end of the exported Data Bindings.
Use this function carefully as this rather expensive and it will not add a new column the header, if the file is already open.
ExportNewCSVLine() Exports a new line with the current values.
GetExportCSVHeader() Calculates the CSV header for the current configuration and bindings.
GetExportCSVLine() Reads the current values, exporting them as CSV string.
GetLocalSavePath() Returns the local safe path either in appdata or in the editor.
ValidateBindings(bool) Utility function called by the editor internally to validate the bindings.

Properties

Name Description
ColumnSeparator Actual separator character used for the columns. Defined by the Separator if not set to 'Custom'.
DataBindings Values and function return values to be exported.
DataExportType How the export should be performed. Either saving to a file or posting as http request.
EscapeColumns If all columns should be escaped to prevent format issues.
ExportDuringUpdateEnabled Will automatically export data each frame in the Update() function.
HttpExportPath Url to post data to when exports should be performed via http.
IncludeDeltaTime Includes the unity delta time.
IncludeHumanReadableTimestamp Includes a timestamp in a human-readable format ('yyyy-MM-dd HH:mm:ss'). Its value is relative to the computers local timezone.
IncludeUnityTime Includes the unity time (time since the app was started).
IncludeUnixTimestamp Includes a unix (numeric) timestamp.
InputActionDataBindings InputAction values values to be exported.
InputActionTrigger Input actions that trigger an export when performed.
LocalExportPath Path to the local export directory relative to the apps data directory (Application.persistentDataPath).
NewExportFilePerPlaythrough When enabled a timestamped export file is created each time the app is started.
PeriodicExportEnabled When enabled, updates are performed periodically after _periodicExportTime seconds.
PeriodicExportTime Frequency in seconds after which an automatic export is triggered, when enabled.
Separator Separator type used for the columns.
⚠️ **GitHub.com Fallback** ⚠️