Easy Stroop Test

Hi everyone, I am trying to implement an easy Stroop test (words and colors) to analyse the stress of the user. So I want to show the “Red” text written in green then i want the user to click on the green button. and so on for each word. This is how I started, I need help for the followings:

  • make the words pop up 1 by 1 (after a button has been clicked)
  • implement condition for each button (if see the “red” text → click on green → correct, otherwise → false)
  • put a background color on my canvas panel :slight_smile:

thanks a lot, here attached are photos any help is appreciated


Could you elaborate a bit more on this part?

  • what’s the initial state of the board?
  • let’s say only Red Box + Green Text reading Red is showing, we click Red Box → what happens next?
  • or the initial state can only be Red Box + Red Text that reads Yellow?

Hi! thank you for your answer.
the initial state of the board would be all 6 colour boxes (=the answer buttons) and 1 by 1, the words are displayed on screen. Let’s say the first word is “red” but written with green ink, the user must click on the green box. If he clicks on the green box → “Correct” then next word pops up. if he clicks on another box → “Incorrect” → still goes to the next word.
Please let me know if i can be any more specific :slight_smile:

1 Like

One more question, does this need to be reusable, randomised and easy to maintain? Or the plan is to hardcode that one board?

mmh I am not sure what you mean, but it should be just a widget that pops up during my VR game and the user must do that little test. I won’t change it once it done. It can be randomised as in the words can pop up in different order

1 Like

Do you have any idea on how I could do that? I am desperate :frowning:

tl;dr: you’d need to learn UMG first in order to make a puzzle mini game.


Yes, I understand what is needed. But you’d need to approach it very differently from what is shown. Since you’re asking:

put a background color on my canvas panel

I’d need to assume your UMG experience is minimal. The answer to the this trivial part is to nest the containers housing the buttons and text. A border will do, you can then colour it. Start with this.


For the rest, in short:

  • you’ll need enumeration and associate it with colors and text
  • you will need vertical and horizontal boxes and use them as containers
  • those containers will serve as arrays so you can operate on the elements inside using indexes
  • ideally, you will wrap the clickable button and text in a user widget, and have it dispatch data to the parent
  • the parent would be responsible for handling logic of what the correct answer is and show the next step - this can be done by simply adjusting the visibility of the desired element

If this is just a one-off, like a homework assignment that does not need to be mutable in any way, is only used once, and does not require granularity → hardcode it. That should simplify it somewhat but it will become convoluted / impossible to work with if you ever want to adjust anything later on.

1 Like

thank you, I will try!

I need to use it for different experiments but the same game so I shouldn’t have to change it once it’s done (correctly).

I call bull$hit on this. What kind of stress analyzer is it, if it actually invokes stress? Because that’s what it did to me. Fun exercise to make, sure. Not fun to be on the receiving end, though!

Is this roughly what we’re after?

If that’s good enough, I can comment it and push the project your way, feel free to take it apart, migrate or use as is.

2 Likes

That is exactly it! thank you that would be amazing!!

1 Like

yes exactly it invokes stress and then I will analyse that stress :slight_smile:
Thanks again for your help!!

1 Like

Do you think you could help me to implement it on unreal engine 5?

A quick overview of how it works:

  • there are 3 separate widgets here:

  • wTextColorLabel with misleading colour who also knows the correct answer:

  • wStressButton that knows what colour it is and dispatches it when clicked:

image

  • wBoard that procedurally adds the above buttons and text to the VBs (vertical boxes):

It’s also responsible for checking answers and controlling the progress.

  • the data is handled by an enumerator:

image

which is mapped to colours in the wBoard:

image

These two need updating if any changes to the scheme are needed. The script revolves around reading this data and applies it automatically.

Project link UE v5.3.1:

Added an actor with a widget component since this is needed for VR. And the component material can now be transparent.


There are more comments in the script. One known potential issue is the way the vertical box handles text removal. The Y location is inconsistent as we simply remove a widget from the parent and let it redistribute automatically. But the bug may be considered a feature since it brings some randomisation to text placement - happy little accidents.

Now after having it done once, I’d do some things slightly differently, ofc. The colour mapping belongs in a function library, for example, so widgets can read the data without having to rely on having it pipped in. But at this scope, it’d be an overkill.

disclaimer: this is very much work in progress but should be easily expandable if needed


Do you think you could help me to implement it on unreal engine 5?

Nah, I have stuff to do, places to be, people to annoy. Not joining projects today. :innocent:

Consider studying and reverse-engineering it. It should, at least, give you an idea of one way to handle it all. There are more ways, surely. As mentioned previously, a more hardcoded approach may be feasible, too.

1 Like

Thank you so so much for all this explanation!!!

Hi, sorry to bother you again. I am trying to understand the script and I just have something that I can’t “locate”. As you see on this photo there is always a more faded word showing up and I am trying to see where that is happening on the script, and would like to remove it. Thanks again for your help!

What is a more faded word? Here we see 2 words.

Hi, I am interested in using a similar game but I would like to make it generate coloured words continously and not make it stop after the 6 words have been found. How should I proceed? I am new to Unreal… Ty very much in advamce!!

Hello! Thank you this! Could you point where the logic for displaying the words is? I am trying to display the coloured words continuously and not stop after they have been showed once but I cannot figure where it is… Thank you

Each word is a separate widget, it is added to a vertical box in parent’s Construct Event. That’s afair.

not make it stop after the 6 words have been found

Once a word is found, it’s removed from the pool. Do not remove it and it will most likely go on forever… but what sort of torture game are you making?! :innocent:

1 Like