hello, so uh, im trying to make a dropdown menu for my game and using this video here

https://godotdevelopers.org/forum/discussion/17966/beginner-optionbutton-dropdown-interaction-gui-in-godot-engine/p1

as reference. But it gave me an invalid call.nonexistent function error. here's the code :

extends Control

export (NodePath) var DropDown_path onready var DropDown = get_node(DropDown_path)

func _ready(): add_items()

#add item to drop down menu func add_items(): DropDown.add_items("option 1") DropDown.add_items("option 2") DropDown.add_items("option 3") DropDown.add_items("option 4")

from my understanding godot doesn't recognize the add_items function but it works just fine on the video, maybe someone can give me a bit of insight ?

thank you a lot.

Are you sure, that DropDown in fact is the PopupMenu node and not the MenuButton? If it is the MenuButton you first have to call the get_popup() function, so it could be:

onready var DropDown = get_node(DropDown_path)

func _ready():
	DropDown = DropDown.get_popup()

@kryzmak said: Are you sure, that DropDown in fact is the PopupMenu node and not the MenuButton? If it is the MenuButton you first have to call the get_popup() function, so it could be:

onready var DropDown = get_node(DropDown_path)

func _ready():
	DropDown = DropDown.get_popup()

DropDown is an OptionButton node, made sure of it. And it works just fine in the vids

That post is from 2016 so chances are high it's using godot 1.x or 2.x

Are you using godot 3.0.x perhaps?

Ok, this is a typo. Method is called add_item() and not add_items()

@Megalomaniak said: That post is from 2016 so chances are high it's using godot 1.x or 2.x

Are you using godot 3.0.x perhaps?

uh yes, i'm using godot 3. kinda difficult to find a suitable godot 3 guide around

@kryzmak said: Ok, this is a typo. Method is called add_item() and not add_items()

uh no, it is add_items()

Not in my Godot Version (3.0.6)

@kryzmak said: Not in my Godot Version (3.0.6)

silly me, the code is on a control node which is the parent of the dropdown node, no wonder i can't use add_item().

4 years later