Class FeedbackDataHandler
Serialises the current values of a set of BaseScriptableVariable feedback metrics and transmits them to the backend at the end of each study scenario.
public class FeedbackDataHandler : MonoBehaviour
Inheritance
Remarks
After each driving scenario the study needs a record of the participant's metric scores
(prosocial score, safe-boundary compliance, yield score) alongside session identity fields.
FeedbackDataHandler reads those values from Inspector-assigned
BaseScriptableVariable assets and packages them with the current
SessionInfo into a JSON payload that the backend can correlate to the
participant's survey and driving logs.
Transmission timing is delegated to GameMode via a subscription: when the
game mode signals the end of a scenario it calls Action). This keeps
FeedbackDataHandler decoupled from the specific study flow.
Methods
SendToServer(Action)
Snapshots all valid feedback variable values, packages them with session metadata, and enqueues the JSON payload for transmission.
public void SendToServer(Action callback)
Parameters
| Name | Type | Description |
|---|---|---|
callback | Action | Invoked after the payload has been accepted by the send queue. |
Remarks
Only variables where IsValid returns true
are included, so metrics that were never written (e.g., from a disabled subsystem)
are silently omitted rather than sending null values. The sendingToServer
guard prevents overlapping transmissions if the game mode fires the event more than
once before the first send completes.