Topic was automatically imported from the old Question2Answer platform.
Asked By
AUD_FOR_IUV
I have a simple UI scene that consists of a VBoxContainer of a few Buttons. By default, I can use the bindings for “ui_up” and “ui_down” 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?
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.
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!
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.