-
Notifications
You must be signed in to change notification settings - Fork 48
Session generation
Jack Brookes edited this page May 30, 2018
ยท
13 revisions
Our Session
component contains our Block
objects, each of which contains Trial
objects. These need to be manually created and ordered in the way our experiment requires.
A common way to generate the blocks and trials for the session would be to call a method using the OnSessionBegin
UnityEvent that generates the blocks and trials for us.
Below is an example MonoBehaviour script that will perform the generation:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
// add the UXF namespace
using UXF;
public class SessionGenerator : MonoBehaviour
{
public void GenerateExperiment(Session experimentSession)
{
// retrieve the n_practice_trials setting from the session settings
int numPracticeTrials = Convert.ToInt32(session.settings["n_practice_trials"]);
// create block 1
Block practiceBlock = session.CreateBlock(numPracticeTrials);
practiceBlock.settings["practice"] = true;
// retrieve the n_main_trials setting from the session settings
int numMainTrials = Convert.ToInt32(session.settings["n_main_trials"]);
// create block 2
Block mainBlock = session.CreateBlock(numMainTrials); // block 2
// here we set a setting for the 2nd trial of the main block as an example.
mainBlock.GetRelativeTrial(2).settings["size"] = 10;
mainBlock.GetRelativeTrial(2).settings["color"] = Color.red;
// we enable a setting if this is the first session, e.g. to show instructions
session.GetTrial(1).settings["show_instructions"] = (session.number == 1);
// we can also do different things depending on participant information
int age = Convert.ToInt32(session.participantDetails["age"]);
session.settings["sensitive_content"] = age >= 18;
}
}
It is very common in human behaviour research to change the structure of the session
๐ง Core topics
- ๐ Background
- โจ UXF 2.0
- โ๏ธ Compatibility
- ๐ถ๏ธ Oculus Quest Setup
- ๐ญ Concepts
- ๐ ๏ธ Get started
- ๐ Examples
- ๐ฅ๏ธ Built-in UI
- ๐ Session generation
- โฐ Events
- ๐ Data collection
- โ๏ธ Collect custom data
- ๐ Custom Data Handler
- ๐ Remote Data Collection
- ๐๏ธ WebGL DynamoDB setup
- ๐ Processing DynamoDB CSVs
- ๐ซ HTTP Post Setup
- ๐ง Settings system
- ๐๐ฝ Tracker system
- ๐ Logging system
โ ๏ธ Common issues- ๐ผ๏ธ Multi-scene experiments
- ๐บ Videos
- ๐จโ๐ Full written tutorial
- ๐ฆ Asset links
- ๐จโ๐ซ Unity tutorial links
- ๐ Useful code snippets
- ๐ก Programming ideas
- ๐งฎ Example R processing