Godot 4 Dropdown Menu

preview_player
Показать описание
Quick tutorial on how to make a dropdown menu in Godot 4!
Рекомендации по теме
Комментарии
Автор

Great tutorial! If anyone wants to know how to deselect afterwards, here is my code. I used a dictionary instead of switch for readability on my end:
func _on_effect_selected(index: int) -> void:
var drop = $"CanvasLayer/Effects Dropdown/Effects" # The instance of your dropdown
var effects = {
0: "level_up"
}

if player.animations and effects.has(index):

drop.selected = -1 # This will return your menu to whatever index you put here
# This will deselect your menu, so you can press space without it reselecting the item in the menu

DT-hbzu
Автор

Let's gooo another quick to the point tutorial!

MK_Codes
Автор

how do i get rid of those circles (check marks) from menu selections or if not possible at least to make it custom img?

Gouzaburou
Автор

I was looking for a tutorial yesterday and now You make one right now.

gmsadventures
Автор

Is it possible to make a multiple-choice dropdown menu? So it would be possible to check and unckeck multiple options at once?

Zeroness
Автор

I was looking for a tutorial about customization. The preview fooled me.

cristianoschiaffella
Автор

This is super awesome, but I need this with MenuButton Node to make my project work.
At 1:17, how can I adress the sub ids from a MenuButton in code? How would the code look like? Thanks🤞
I have currently this, and it signals a message when ever pressing the main button instead of the sub items:


extends MenuButton

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

func _on_pressed() -> void:
print("test")

marco
Автор

Do you know how to add a theme to the dropdown menu because when I do, the main thing is affected, but the options below aren't

moonstonenorman
Автор

So if I want to have the button state 'select an option' it should be added as an item and I should make that the starting option?


Also for us who enjoy or need to use it dynamically (adding and removing items through code instead of the inspector) it is true the godot docs do need work or just more examples on nodes

trovestove