Class MasterDatalog
The per-actor envelope produced by DataCollector that bundles all component-level data snapshots for one collection event into a single timestamped record.
[Serializable]
public class MasterDatalog : DataLog
Inheritance
Remarks
Each actor in the simulation (vehicle, pedestrian, …) that has a DataCollector
produces one MasterDatalog per analysis trigger. The envelope stores the actor's
game-object name (for post-session identification) and a heterogeneous list of
DataLog subtype entries — one per IDataLoggable component on
that actor (e.g., BatteryDataLog, TransformDataLog).
Inheriting from DataLog rather than being a separate type allows a session-level
log list to hold both individual component entries and actor-level envelopes in a single
polymorphic List field under [SerializeReference].
Constructors
MasterDatalog(string, List<DataLog>)
Creates a new envelope for the actor named name, capturing the current
wall-clock time as the collection timestamp.
public MasterDatalog(string name, List<DataLog> list)
Parameters
| Name | Type | Description |
|---|---|---|
name | string | The GameObject.name of the actor that owns these logs. |
list | List<DataLog> | Pre-collected list of DataLog entries for this actor. |
Remarks
The timestamp is captured in the constructor rather than being passed in so that the recorded time reflects exactly when the data was gathered, even if the envelope is deserialised or processed later by an asynchronous analysis pipeline.
Fields
data
The per-component data snapshots collected from this actor's IDataLoggable components.
[SerializeReference]
public List<DataLog> data
Field Value
Remarks
[SerializeReference] is required here because the list is heterogeneous —
entries can be BatteryDataLog, TransformDataLog, or any other
DataLog subclass. Without [SerializeReference], Unity's serializer
would strip the concrete type and only retain the base-class fields on deserialisation.
name
The GameObject.name of the actor that owns this log entry.
public string name
Field Value
string
Remarks
Stored as a plain string so the log can be deserialised and matched back to its actor after the Unity session has ended, without requiring a live scene reference. Actor names must be unique across the scene to make this mapping unambiguous.
unixTimestamp
Wall-clock time at which this record was collected, expressed as milliseconds since the Unix epoch (1 January 1970 UTC).
public double unixTimestamp
Field Value
double
Remarks
Unix epoch milliseconds are used rather than Time.time (session-relative seconds)
so that logs from multiple runs or multiple machines can be merged and sorted in absolute
chronological order without a shared session reference. Millisecond resolution is sufficient
for the study's analysis cadence.
Methods
Add(DataLog)
Append a child data log to the master data log.
public void Add(DataLog dataLog)
Parameters
| Name | Type | Description |
|---|---|---|
dataLog | DataLog | The data log to append. |
IsEmpty()
Returns true when no child data logs were collected, indicating the actor produced
no meaningful data for this event.
public bool IsEmpty()
Returns
bool — true if data is empty; otherwise false.
Remarks
Collect uses this to suppress empty envelopes and avoid allocating placeholder entries in the analysis output for inactive actors.