Clicking and dragging a Control Node

Godot Version

v4.2.2.stable.official [15073afe3]

Question

I have a subscene that contains some stuff that I want to click an drag as a unit

image

But I can’t get it to drag when I overwrite the _get_drag_data() function. I am instantiating an instance of the scene for the drag preview, but nothing is happening when I click and drag.

previously I had the root of the interface element subscene a button and it worked, but changing it to a control node made up of sub elements seems to have broken it. I would prefer not to use a button node as the root of the ui element subscene

@onready var item = load("res://Scenes/Stats/StatBonus.tscn")
func _get_drag_data(at_position):
	var data = {}
	
	var drag_item = item.instantiate()
	
	set_drag_preview(drag_item)
	
	return data

Am I missing a step?

I wasn’t passing the mouse filter of the ColorRect and it was capturing the mouse click instead of passing it up to Bonus.

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