The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+1 vote

I have a simple UI scene that consists of a VBoxContainer of a few Buttons. By default, I can use the bindings for "uiup" and "uidown" to navigate the menu. However, it doesn't seem like I can wrap around by default (i.e. when I'm at the bottom, if I hit "ui_down" it doesn't wrap around and change focus to the top).

Is this possible to configure somewhere in the inspector or something? Or will I have to do this in code by manually intercepting those UI events and checking if I'm at the top/bottom and changing focus accordingly?

Thanks in advance for the help!

in Engine by (45 points)

2 Answers

+1 vote
Best answer

Turns out you can use the Focus Neighbor Top/Neighbor Bottom properties to do this in the inspector by setting the top button's Neighbor Top to the bottom button and the bottom button's Neighbor Bottom to the top button.

by (45 points)

Good to know you found your answer.

+2 votes

Have you looked into the wrapi() function? Track which button is currently selected via a counter. Use wrapi(counter + 1, 0, number_of_buttons), and have the selection return to the first button.

by (3,164 points)

So then it's not possible to configure this in the inspector? I was hoping not to have to do this in code but if that's the case then wrapi() looks promising. Thanks!

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.