get_selected_metadata returns null

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Xiuhman

It’s probably a dumb mistake that I’m making but I can’t seem to get it to work, I’m simply trying to get the selected resolution option…

Here’s the code I’m using.

onready var Resolution_Option = get_node("SettingsPopUp/CenterContainer/VBoxContainer/Resolution_Option")

func _on_Resolution_Option_item_selected(ID):
  var Resolution = Resolution_Option.get_selected_metadata()
  print(Resolution)

And it prints “Null”

I’ve also tried…

func _on_Resolution_Option_item_selected(ID):
  var Resolution = Resolution_Option.get_item_metadata(ID)
  print(Resolution)

Also prints “Null”.

:bust_in_silhouette: Reply From: Xiuhman

Turns out I was using the wrong function…

It’s

get_item_text ( int idx ) const

Not

get_selected_metadata ( ) const