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.
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 › Experiment Variables is the first of three tabs. It's where you declare the experimental variables — within-subjects (vary across trials within one participant) and between-subjects (vary across participants but stay constant within one session) — and where the editor calculates how many trials each session will run.
This is usually the first tab you fill in for a new scene, because the State Machine tab's trial loop and the State-listening Items grid both reference variable values that don't exist until you declare them here.
Screenshot pending — the Experiment Variables tab with one within-subjects variable (
textwith valuesRed, Blue) and one between-subjects variable (orderwith valuesRB, BR).
Two sections, same fields
The tab has two parallel forms:
- Variables for Within-Subject Conditions — what changes from trial to trial for the same participant.
- Variables for Between-Subject Conditions — what differs between participants but stays constant within a session.
For an introduction to the distinction (and why it matters for analysis), see Concepts → Within vs. between subjects.
Each section is a list. Add a row with + Add Variable, fill in the four fields below, and the editor writes the values into Assets/_Experiment_/Settings/ExperimentVariables/<SceneName>.js.
Fields per variable
| Field | Type | What it controls |
|---|---|---|
| Name | string | The variable's identifier. This is the key you'll look up as CONDITION["<name>"] in your scripts. Use a stable, code-friendly name (e.g., fontColor, depth, not Font Color!). |
| Values | comma-separated list | The full set of values the variable can take. Order matters when isRandom is unchecked. Example: Red, Blue or near, far. |
| isRandom | checkbox | If checked, trials draw values in randomized order each session. If unchecked, the order is exactly the list in Values. For between-subjects variables, this checkbox is currently forced to true — each session is randomly assigned one value. |
| Trials Count per Condition | integer ≥ 1 | How many trials per condition combination. The total trial count is `(product of within-subjects |
Between-subjects assignment is currently always random. Future LUIDA versions plan to let you assign between-subjects values based on pre-session questionnaire answers (e.g., counterbalance condition based on participant demographics), but for now: random, with optional debugValue overrides via isTestMode.
How the trial count is calculated
Suppose you declare:
- Within-subjects
textwith valuesRed, Blue(|Values| = 2) - Within-subjects
fontwith valuesR, B(|Values| = 2) - Trials Count per Condition = 5
Then each session runs 2 × 2 × 5 = 20 trials — the cross-product of within-subjects values multiplied by the per-condition repetition count. Between-subjects variables don't multiply the count (they affect which between-subjects value is fixed for the session, not how many trials happen).
The editor displays this calculation live on the right side of the tab as you edit values. Use it to sanity-check that a 20-minute session isn't going to balloon into 4 hours of trials.
Screenshot pending — the Variables tab showing the auto-calculated trial count "20 trials per session" on the right side after the two within variables and Trials Count per Condition = 5 are set.
How to access values at runtime
In any state-listening action's Customized Action code block (or in your data calculator script), the active values are exposed as:
CONDITION["<name>"]— the current trial's values for this trial. Within-subjects values change every trial; between-subjects values stay the same for the whole session.- Look at Reference → Variables for the full lifecycle (when values are populated, when they refresh, what to do outside of trial states).
A typical use inside a Customized Action on Trial - Start:
const text = CONDITION["text"]; // "Red" or "Blue"
const font = CONDITION["font"]; // "R" or "B"
SetText(text);
SetChildPosition("Stimulus", 0, 1.5, 0);
ShowItem();Where it gets stored
The tab writes to:
Assets/_Experiment_/Settings/ExperimentVariables/<SceneName>.js…which is loaded by the LUIDA-ExpManagers prefab's ConditionManager at session start. The file is plain JavaScript — you can read it for debugging, but always edit it through this tab, never by hand (the editor regenerates the file on save).
Saving and reloading
Click Apply at the bottom of the tab to flush changes to disk. If you edit the file directly and Unity reloads, the editor will re-read on next focus. The auto-calculated trial count refreshes as you type.
Common pitfalls
- Misspelled
Name.CONDITION["FontColor"]returnsundefinedif the variable was declared asfontColor. Names are case-sensitive. - Whitespace in Values.
Red, BlueandRed,Blueboth work — leading and trailing spaces are trimmed — but"Red","Blue"doesn't (you don't need quotes). When in doubt, no quotes, no extra symbols. - Setting
isRandom=falseand expecting per-participant randomization. If the box is unchecked, the same trial order is used every session. Re-check it if you wanted randomization. - Forgetting to update Trials Count per Condition. A change in Values doesn't reset the count; it stays at whatever you last set.
Where to go next
- State Machine tab — the next tab; now that variables exist, set up the trial loop that uses them.
- Concepts → Within vs. between subjects — the theoretical grounding plus the runtime assignment algorithm.
- Reference → Variables →
CONDITION— full caveats list for reading values at runtime. - Tutorial 3 — Stroop Effect (Other sample) — uses three within-subjects variables and one between-subjects variable.
Editor windows reference
Every LUIDA-provided Unity menu and editor window, page by page. The Configure experiment automation tabs, the identifiers window, scene + GameObject menus, the avatars window, the data collector window.
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.