0 votes

Hello! I'm new to Godot and coding games in general. I am wondering how I can make an input stepper like the one shown below. I think I can make a counter with incrementor arrows using the documentation tutorials, but I'm not sure how I can combine that with a text input field, so that you can set a number with direct input and clicking the arrows. Thanks in advance!

Edit: thanks for the help!!

input stepper

Godot version 3.2.2
in Engine by (17 points)
edited by

2 Answers

+1 vote
Best answer

I would use a LineEdit node and add two buttons for the up and down arrows. Then give the LineEdit a script and have it set_text() to the entered value or the incremented value.

if you want to make it so the user can only input integers, you can use the LineEdit's textchanged signal, which is emitted after each character inputted, and check if the character is an int. If it is, settext(), else, set_text() to the previous value.

by (577 points)
selected by
+2 votes

Try modifying a Spinbox.

by (7,190 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.