Configure experiment automation › State Machine & Questionnaires
Tab 2 of the LUIDA automation window. Order the experiment's states, configure exit times and loops, bind questionnaires by qID.
These pages are not yet fully reviewed. The LUIDA team is continuing to review and improve them. If you find anything wrong on these pages, or have questions that aren't resolved by reading them, please ask or report to the LUIDA team.
LUIDA › Configure experiment automation › State Machine is the second tab. It defines what states the experiment moves through, in what order, and what happens at each state boundary. Every state-listening item in the next tab is configured against the states you list here.
Screenshot pending — the State Machine tab populated with Intro, CalculationTask (Repeat ×5 back to itself), Trial - Start, Trial - Rest (3s), Outro (qID 2), End — the Stroop tutorial setup.
How states work
LUIDA experiments are state machines. At any time the experiment is in exactly one state; transitions happen when:
- A state's Exit Time elapses (if configured), or
- An action calls
ToNextState()(typically from a Customized Action or aLuida To Next State Gimmickon a CCK trigger).
LUIDA reserves two special states for the trial loop:
Trial - Start— the boundary at which within-subjects variables refresh. Every iteration of the trial loop entersTrial - Startwith newCONDITIONvalues.Trial - Rest— a built-in inter-trial-interval state, typically used for a fixation cross or a "press a key to continue" pause.
You can have any number of states between Trial - Start and Trial - Rest, and the loop runs until the auto-calculated trial count (set in the Experiment Variables tab) is exhausted.
For the full lifecycle, see Concepts → State machine lifecycle.
The list
The tab shows an ordered list of states. Each row has a name (e.g. Intro, Trial - Start, Outro) and a small toolbar with the per-state options below. Add State at the bottom inserts a new row; Move state to ▲ / ▼ reorders.
Per-state fields
| Field | Type | What it controls |
|---|---|---|
| Has Exit Time | checkbox + seconds field | If checked, the state ends automatically after the entered number of seconds (Exit time (seconds)) and transitions to the next state in the list. Use for fixed-duration states like a 3-second fixation cross, an instruction display, or a Rest interval. |
| Is Repeated | checkbox + destination + count | If checked, when this state ends, the machine doesn't advance to the next list entry — instead it returns to the state named in Repeat Destination and repeats this loop Repeat Count times before falling through. Use to construct nested loops inside the trial loop (e.g., five mental-math problems per trial). |
| Questionnaire — qID | integer (optional) | If set, displays the questionnaire registered at that 1-based index in the Web Console while this state is active. The participant must answer (or skip, if optional) before the state's exit conditions are evaluated. |
Has Exit Time — fixed-duration states
The simplest pattern. Check the box, enter seconds, save. When the state's On State Start listeners finish firing, a timer starts; when it expires, the state ends.
Examples:
Trial - RestwithHas Exit Time = true, Exit time = 3.0— three-second fixation between trials.OutrowithHas Exit Time = true, Exit time = 10.0— display a thank-you message for ten seconds, then end the session.
Without Has Exit Time, the state runs forever until an action explicitly calls ToNextState(). Use this for response-driven states where the participant determines when to advance.
Is Repeated — nested loops
When Is Repeated is checked, the state becomes the tail of a sub-loop. After the state's exit conditions fire, the machine jumps to Repeat Destination (an earlier state in the list) and replays from there. This counts as one loop iteration; when Repeat Count is reached, the next exit instead advances normally.
A common pattern from Tutorial 3 (Stroop):
Intro
CalculationTask (Has Exit Time = on) ← Repeat Destination
…
CalculationTask (Has Exit Time = on, Is Repeated = on, Repeat Destination = CalculationTask, Repeat Count = 5)
Trial - Start
Trial - Rest (3s)
…The result: five rounds of CalculationTask before each trial. The trial loop itself is a different mechanism — it's controlled by the auto-calculated trial count, not by Is Repeated.
Is Repeated defines intra-trial loops. The trial loop itself (Trial - Start → ... → Trial - Rest → Trial - Start with new CONDITION) is automatic and controlled by the Variables tab's trial count, not by these checkboxes.
Questionnaire / qID — surveys mid-experiment
Set qID on any state to display a questionnaire during that state. The questionnaire is rendered as an in-world UI panel, the participant answers, and answers are dispatched back to the Web Console under the experiment's session ID.
qIDis the 1-based index of the questionnaire in your experiment's Web Console questionnaire list. The Web Console assigns IDs in registration order — so the second questionnaire you added getsqID = 2. See Concepts → Questionnaires for the binding model.- Leave qID blank for states that don't show a questionnaire (most of them).
- The questionnaire UI is provided by a
Questionnaireprefab in the scene; insert one viaGameObject › LUIDA › Questionnaire.
Screenshot pending — a state with
qID = 2set, plus the Web Console questionnaire list showing the matching ID.
The questionnaire blocks state exit until answered (or until the participant skips, if the questionnaire's questions are all optional). Pair qID with Has Exit Time only if you want a time limit — usually you don't.
Where it gets stored
The tab writes the ordered state list and per-state settings to a ScriptableObject:
Assets/_Experiment_/Settings/StateList/<SceneName>.asset…referenced by the scene's LUIDA-ExpManagers prefab at runtime. The file is binary YAML (Unity's standard asset format); edit only through this tab.
Saving and reloading
Click Apply at the bottom of the tab to flush. The State-listening Items tab reads from the same StateList asset, so changes made here surface as new rows in that grid immediately.
Common pitfalls
- Renaming
Trial - StartorTrial - Rest. Don't. These names are reserved keywords for the trial loop. Renaming breaks the loop and the within-subjects variable refresh. Has Exit Time+Is Repeatedinteraction. The Repeat fires after the Exit Time, so the per-iteration duration is the Exit Time. Total time for the sub-loop ≈Exit Time × Repeat Count.- qID off-by-one. The Web Console list is 1-indexed; if your questionnaire is the third in the list,
qID = 3, notqID = 2. - Deleting a state that's referenced as a Repeat Destination. The other state's pointer becomes invalid; the tab shows an error. Fix the destination or remove the
Is Repeatedflag.
Where to go next
- State-listening Items tab — the third tab; bind item behavior to the states you just listed.
- Concepts → State machine lifecycle — the trial loop and state-transition model in depth.
- Concepts → Questionnaires — qID binding, built-in templates (IPQ, SSQ), runtime answer flow.
- Tutorial 3 — Stroop Effect (Other sample) — uses
Has Exit Time,Is Repeated, andqIDtogether.
Configure experiment automation › Experiment Variables
Tab 1 of the LUIDA automation window. Declare within-subjects and between-subjects variables; the trial count is auto-calculated.
Configure experiment automation › State-listening Items
Tab 3 of the LUIDA automation window. The grid of items × states — where each cell binds actions to state entry, during, and exit, plus a per-item always-on event-handler section above the grid.