Skip to main content

Creating Your First Stroop Test

The finished Stroop Test

This guide walks you through the steps to create a simple Stroop Test in Unity using the provided templates and components. You'll learn how to set up a Stroop Test scene, configure input prompts, define a sequence of stimuli, and connect everything so that participants can complete the test and have their responses recorded. By the end of this guide, you'll have a functioning Stroop Test ready for deployment in your study.

1. Create the Stroop Test Scene​

First, create a Stroop Test Scene. Use the Stroop Test scene template, which provides a ready-made setup with all the necessary components for running a Stroop Test.

image of Stroop Test Scene opened in Editor

1
Open New Scene

In Unity's main menu, select File > New Scene (or press Ctrl + N).

image/gif of File > New Scene

2
Select the Stroop Test template

In the New Scene Dialog, select the Stroop Test template.

image of New Scene Dialog with Stroop Test Selected

3
Open the Untitled scene

An Untitled Stroop Test scene opens in the Editor.

image of Untitled Stroop Test Scene opened in Editor

4
Save the scene

Save the scene immediately (Ctrl + S), choose a location, and give it a meaningful name (for example, MyFirstStroopTest).

image of saved Scene in project window

You should now have a Stroop Test Scene with a sample Stroop Test and input already set up.

2. Optional Input Actions Setup​

This optional section guides you through creating an Input Actions asset similar to the pre-configured StroopTestInputAction asset included in the template, so you can replicate or modify it if needed. (The pre-configured asset names its map Stroop Input Action Map and its actions Input Action Red (Left Arrow), Input Action Green (Down Arrow), and Input Action Blue (Right Arrow).)

Image of pre-configured Input Actions

1
Create an Input Actions asset

In the Project window, select Right-click > Create > Input Actions. Give the new asset a name, for example MyStroopTestInputActions.

Image/gif of creating Input Actions

2
Open the Input Actions editor

Double-click the newly created Input Actions asset in the Project window to open the Input Actions editor.

Image of Input Actions editor

3
Create an Action Map

In the Action Maps panel on the left, click + to create an Action Map. Enter a descriptive name for the map, for example My Stroop Input Action Map.

Image of Add button in Action Map panel

An Action Map is a container for input bindings and actions.

Image of created action map

4
Add three actions

In the Actions panel, click + to add new actions.

Image of Add Action button highlighted

Create three actions and name them SelectRed, SelectBlue, and SelectGreen.

Image of three created new actions

5
Set Action Type to Button

In the Action Properties panel, set the Action Type for each action to Button.

Action Type set to Button

6
Create bindings

Click the + button next to an action to create a binding.

Image of Add Binding button highlighted

7
Assign keys to each action

In the Binding Properties panel, click the Path field to bind an input to the action.

Image/gif of Path in Binding Properties

Assign keys or buttons to each action:

  • SelectRed → Keyboard → Left Arrow
  • SelectBlue → Keyboard → Down Arrow
  • SelectGreen → Keyboard → Right Arrow
8
Save the asset

Click the Save Asset button to save your changes.

Image of Save Asset highlighted

9
Select StroopTest UI Document in the Hierarchy

In the Hierarchy, select StroopTest UI Document.

Image of StroopTest UI Document selected in the Hierarchy

10
Assign Action References

In the Inspector, find the StroopTestGenerator component, locate the Action References list, and assign the following InputActionReferences to it (replacing the three pre-assigned references): SelectRed, SelectBlue, SelectGreen.

Image of Assigned Action References list

11
Save the scene

Save the scene (Ctrl/Cmd+S).

With these steps complete, your custom input actions are fully set up and connected to the Stroop Test scene. You can now move on to creating the stimuli, and then the Stroop Test Set Data, which together drive the actual test.

3. Creating Stroop Test Stimuli​

Next, create Stroop Test Stimulus assets to define the three stimuli shown below:

Stimulus Red Stimulus Blue Stimulus Green

1
Create the first Stimulus asset

In the Project window, right-click and select Create > ScriptableObject > Assessments > StroopTest > Stimulus. Name the new asset Stimulus_RED_Blue.

Image of stimulus create menu

2
Configure Stimulus_RED_Blue

With the asset selected, set Word to RED and Color to in the Inspector.

Image of stimulus's inspector with configured properties

3
Create the remaining stimuli

Repeat steps 1–2 to create two more stimuli:

  • Stimulus_BLUE_Green with Word: BLUE, Color:

    Image of Stimulus_BLUE_Green's inspector

  • Stimulus_GREEN_Red with Word: GREEN, Color:

    Image of Stimulus_GREEN_Red's inspector

With these three Stroop Test Stimulus assets created, you now have the building blocks needed for the test. In the next section, you configure the Stroop Test Set Data, where these stimuli are linked to input prompts to define the actual test items.

4. Creating Stroop Test Set Data​

Now that the stimuli are ready, you can create Stroop Test Set Data assets. These assets define what participants see during a Stroop Test.

1
Create a Stroop Test Set asset

In the Project window, right-click and select Create > ScriptableObject > Assessments > StroopTest > Set. Give the new asset a name that makes it easy to identify later.

Image of Stroop Test Set Data create menu

2
Open the Set Data asset in the Inspector

Select the Set Data asset. The Inspector should now show the Input Prompt boxes and the Stroop Stimuli list.

Image of Stroop Test Set Data inspector

3
Configure Input Prompt - Left

Configure Input Prompt - Left in the Inspector.

Image of Input Prompt - Left in Inspector

  • In the top image field, assign keyboard_arrow_left.png.
  • In the middle field, enter Red.
  • In the bottom color field, set the color to .
4
Configure Input Prompt - Middle

Configure Input Prompt - Middle in the Inspector.

Image of Input Prompt - Middle in Inspector

  • In the top image field, assign keyboard_arrow_down.png.
  • In the middle field, enter Blue.
  • In the bottom color field, set the color to .
5
Configure Input Prompt - Right

Configure Input Prompt - Right in the Inspector.

Image of Input Prompt - Right in Inspector

  • In the top image field, assign keyboard_arrow_right.png.
  • In the middle field, enter Green.
  • In the bottom color field, set the color to .
6
Set Stimuli List size

Set the Stroop Stimuli list's Size to 3.

Image of Stroop Stimuli list's size box highlighted

7
Assign stimulus assets to the list

Assign each element of the Stroop Stimuli list to the corresponding stimulus asset:

  • Element 0 → Stimulus_RED_Blue
  • Element 1 → Stimulus_BLUE_Green
  • Element 2 → Stimulus_GREEN_Red

Image of Stimuli List with asset assigned

tip

The order of stimuli in the list determines the sequence in which they appear during the test. Make sure each stimulus is placed in the correct position to match its intended input prompt.

8
Select StroopTest UI Document in the Hierarchy

In the Hierarchy, select the StroopTest UI Document GameObject.

9
Locate the Stroop Test Set Data field

In the Inspector, locate the Stroop Test Set Data field on the Stroop Test Generator component.

10
Assign the Set Data asset

Drag your newly created Set Data asset from the Project window into the Stroop Test Set Data field.

Stroop Test Set Data field assigned

With the Set Data asset assigned to the Stroop Test Generator in the scene, the Stroop Test is fully configured. You can now click Play to test whether the stimuli work as expected.