0 votes

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...

Trying to get the selected resolution

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".

in Engine by (65 points)
edited by

1 Answer

0 votes
Best answer

Turns out I was using the wrong function...

It's

get_item_text ( int idx ) const

Not

get_selected_metadata ( ) const
by (65 points)
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 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 webmaster@godotengine.org with your username.