0 votes

In Project Settings > Input Map, the "ui_down" action is the action used by Godot's native UI system for navigating downwards in whatever UI you are creating. Similarly for "ui_up", "ui_left", and "ui_right".

Currently, I have "ui_up" mapped to the up key on the keyboard, dpad up on controller, and left stick up on controller. My menu is simply a collection of buttons arranged vertically. On load, the topmost button is selected and the user can navigate up or down.

Keyboard and controller dpad work fine, as they are digital button presses. Left stick up, however, is an axis, and so when you press it while on the menu, you simply fly through all the buttons in the menu, every tick of update.

So my question is, what's a good way to keep "ui_up" mapped to joystick axis, but prevent flying through menus because of the analog input? Does Godot offer a simple way to do this out of the box, or do I need to do some custom scripting?

Godot version v3.4
in Engine by (1,602 points)

2 Answers

0 votes

Don't know if anyone has a better solution but I would cheat the system by:

-Put a timer node somewhere that makes sense
-Connect the timer nodes timeout signal to the input script
-Make a bool variable, like 'canmove = true'
-Set the timers time to something short like 0.3 seconds or so (or shorter, play around with it)
-Nest the input under the 'if canmove == true:' condition
-Nest and set 'canmove' to false under the input code and start the timer.
-Set the signal time out function to change the 'canmove' to true when finished

Not sure if this will work with your setup, but anyway.

Edit: had to reformat a little

by (105 points)
0 votes

I think what you described is a bug in v3.4: https://github.com/godotengine/godot/issues/54959

Try Arkinum's workaround above, otherwise you might have to avoid using the analog stick for ui navigation for now.

by (95 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 Frequently asked questions and 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 [email protected] with your username.