UI Button Input only allows one digit – how to accept multiple digits?

Hey everyone!
First off, please don’t judge too harshly — I’m still new to Unreal Engine.
So, here’s the idea: I’m working on a game where the main mechanic is “solve a math problem correctly to defeat an enemy.” In short, every time a level is initialized, a random math problem is generated, and the player can start entering numbers at the bottom of the screen (the input is handled through buttons). The problem appears at the top, and you press the correct number to move on. Pretty simple.

Now, the issue is that the game logic currently allows problems with two-digit answers, but at the moment, the input system only supports entering a single digit — anything more and it won’t let the player continue.
So, here’s my question: how can I set up the input to allow entering two or more digits? Right now, number input happens when the player presses buttons, and the selected numbers appear in an InputTextBlock. I need to make it so the player can enter multiple digits into that InputTextBlock.

PS: On screenshots you can see how my game is look and how the Widget Logic is work for now.

Any help would be super appreciated!




hey @5HT.dvd how are you?

Im not sure if im following your question.

I’m not sure if I’m following your question.

You mean, for example, the problem you mentioned: 9 + 3.
That would be 12.

The player presses number 1, everything is fine, but then when they press 2, it overrides the 1 instead of appending it, right? Also, based on your Blueprints, you’re calling ‘Handle Input’, which I assume is checking the answer in the GameMode.

If that’s the issue, it’s probably because you’re setting the text every time the player presses a button, which ends up overriding the previous value instead of adding to it.

There are different ways to fix this.

What I would do is store the number in a variable (as an integer), and then convert it to text to update the TextBlock.
For the gameplay logic, you can check the answer once the full number has been entered. That means if the answer is 4, the player might have to write 04—but that depends on how your game is designed.

Something like this:

1 Like