Gdscript connect() function :/
-
After a hours of attempts, I can't make it... Can anyone help me why this connect() function always shows error not matter what I do--
myTime.connect("timeout", self,
"_on_timer_timeout")This one line of code shows three errors--
Line 11: Invalid argument for "connect()" function: argument 2 should be "Callable" but is "Resource".
Line 11: Cannot pass a value of type "String" as "int".
Line 11: Invalid argument for "connect()" function: argument 3 should be "int" but is "String".
Help please
-
Maybe use API to connect the timeout function in parent node?
If you want to use connect() , maybe try:
myTime.connect("timeout", self, xxx)
func xxx():
// do some things -
Your method is correct but only for godot 3, for godot 4 you use
node.connect("timeout",self._on_timer_timeout)Or
Node.timeout.connect(self._on_timer_timeout)
-