Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | PercentageProud |
I have a control node that needs to be instanced into the scene. I connect it via code:
var selected_node
onready var example_node=preload("res://example_node.tscn")
func _ready():
refresh_nodes()
func refresh_nodes():
var new_node=example_node.instance()
$parent.add_child(new_node)
new_node.connect("gui_input",self,"_on_new_node_gui_input",[])#?
func _on_new_node_gui_input(event: InputEvent, new_argument):
if event.is_action_pressed("ui_select"):
selected_node=new_argument
print("Node clicked")
I have other errors preventing me from making changes to this code (as I know that it does not cause the crash I’m currently procrastinating a fix on), my question is what I can do to the line with a question mark commented at the end to add the new_node
node as an argument to the signal at the connection. I have prepared code using the argument in the handling function. My assumption is that I can list any arguments to add to the connection to the array at the end of the sample code’s line 8 in the signal connection. Will this argument override the inputevent? Will it come before the event? I’ve scoured the API to no avail.