How to use ShortCut with PopupMenu

Godot Version

Godot 3.5.3

Question

I can’t figure out how to use ShortCut with PopupMenu, I use this code

var inp = InputEventKey.new()
	inp.scancode = KEY_S
	inp.control=true
	var shrt = ShortCut.new()
	shrt.set_shortcut(inp)
	get_node("CanvasLayer/GUI/MenuMain").add_item("Save Project")
	get_node("CanvasLayer/GUI/MenuMain").add_shortcut(shrt)

but ShortCut is considered as a separate menu, how can I have text and ShortCut together?

Try with PopupMenu.set_item_shortcut() instead.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.