0 votes

The documentation isn't very clear on how to use these control nodes. Do I need to add items to them programmatically or can I do that in the editor? If I can do it in editor, how do I add items? I tried to add children nodes, or even a PopupMenu node with its own children, but the OptionsButton and MenuButton still don't display any of these, and are not behaving the way I would expect. Any help would be appreciated.

in Engine by (21 points)

1 Answer

+2 votes
Best answer

here code that I used in demo of character screen:

func generate_selection(items):
    var ui_node = OptionButton.new()
    for item in items:
    return ui_node

Basically you are adding items that are strings to option button similary you can work with MenuButton but you need to add items to its popup and not button directly e.g. your_menu_button.get_popup().add_item("your item")

by (1,022 points)
selected by
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.