immersivecognition / unity-experiment-framework

UXF - Framework for creating human behaviour experiments in Unity

Home Page:https://immersivecognition.github.io/unity-experiment-framework/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support post session surveys

songer1993 opened this issue · comments

The UI support is great for pre session data collection. It would also be nice to have that for post session questionnaires such as NASA-TLX.

Its a great idea but I don't I'll have time personally to do a good job of this

To solve this problem, you could build your own UI, collect responses, then use the built-in data collection functionality to save the data. For example,

// have this method run after the final trial, but before the session ends
public void SaveSurvey()
{
    // show questions and get responses via the UI

    string exampleQuestion1 = "How difficult was the task";
    string exampleResponse1 = "Easy!";

    string exampleQuestion2 = "How are you feeling today on a scale of 1-7";
    int exampleResponse2 = 6;
    
    // questions are headers
    var headers = new string[]{ exampleQuestion1,  exampleQuestion2 };
    var surveyData = new UXF.UXFDataTable(headers); 

    // one row for the response
    var surveyResponse = new UXF.UXFDataRow();
    surveyResponse.Add((exampleQuestion1, exampleResponse1));
    surveyResponse.Add((exampleQuestion2, exampleResponse2));

    surveyData.AddCompleteRow(surveyResponse);

    // save output
    UXF.Session.instance.SaveDataTable(surveyData, "survey");
}

Thank you for the great example of custom datatable, it helps a lot.