0 votes

The error: Invalid type in function 'connect' in base 'LineEdit (LineEdit_Name.gd)'. Cannot convert argument 2 from String to Object.

Here is my code:
self.connect("text_changed", "../../../NPCPanel", "_changeVariable", [get_name()])

NPCPanel: func _changeVariable(name): #print(text) print(name) pass

It sais it has problems with argument 2 but there is only one and even if I remove it:
self.connect("textchanged", "../../../NPCPanel", "changeVariable")
I still get the same error.

I have no idea what's wrong it should work I even got help in the chat but I can't find what the error is. Changed it >30 times Tried researching/searching it but to no avail.

Answer:
"../../../NPCPanel" had to change that in get_node("../../../NPCPanel")

asked 4 days ago in Engine by BrahRah (14 points)

Answer: "../../../NPCPanel" had to change that in
get_node("../../../NPCPanel")

Aren't they kind of the same?

All this path stuff is so error prone. What if you change the node name? Suggest to either use FindNode (if node name is unique and still has the renaming problem) or assign the node to a variable and pass it into the function that's doing the connect.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.