I wonder is there drag-drop file listener in godot engine

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

I found drag file to godot program change mouse shape (with plus)

is there any listener for that?

enter image description here

:bust_in_silhouette: Reply From: rainlizard
func _ready():
	get_tree().connect("files_dropped", self, "_on_files_dropped")

func _on_files_dropped(files, screen):
	print(files)

“files” is a PoolStringArray containing strings of all the files you’re dragging, so use files[0] if you only need one.

WOW, Awesome !
Thank you, rainlizard !

liss22 | 2021-03-22 02:01

:bust_in_silhouette: Reply From: iwanofu

For Godot 4:

func _ready():
	get_tree().get_root().files_dropped.connect(_on_files_dropped)

func _on_files_dropped(files):
	print(files)