UMG Text Box - Only One Option

Hello everyone.

So I have a text box set up so that when the player clicks on it, and types in “south” the player is translated south.

Everything works fine, except for the player input.

If a player types in nothing at all and presses enter the player still moves south.

Is there any way to limit player input in the text box so that it will only move the player south if they type “south” (and not “north” or “ice cream”)?


~ Jason

Seems like you are not actually working with the word that is typed in.
Can you show me your setup?

Normally you can add an event for the TextBox which reacts to committing the text.
It gives you an enum which lets you check how it was committed (Enter press etc).
Then you could search for “Switch on String” (just by right clicking). When you
connect the text to the Switch, you will get small cast node. With the text alone
you won’t find that switch node, since the variable is of type text and the node of type string.

The Switch on String can be modified by selecting it and looking in the left details panel.
There you can add new Options and a Default pin.

Default will be called if the other options aren’t valid. So ice cream for example x)

(Note: This is from my own project, so ignore the other variables in the variable tab)

You, my friend, are amazing!

That worked exactly as I wanted it to!

Thanks for explaining everything as well, I appreciate the detail.

Just for kicks, here was my original setup…

Thanks again for the help!

~ Jason

Click me

Yeah ok xD you can tell yourself that your old setup would do this even with an empty text.

Glad i was able to help!