func _on_pressed() -> void:
force_drag(self,duplicate())
func _gui_input(event: InputEvent) -> void:
if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
force_drag(self,duplicate())
print("我已被点击 D:%s" % name)
accept_event()
the force_drag work perfect if i use ‘_on_pressed’ , and when i change to ‘_gui_input’ , it doesn’t work , i don’t know why . can some one help me , thank you!
The _gui_input() is processed a few lines above, it will force the drag so gui.dragging will be true and the mouse button index is also left so it immediately drops the drag data.